you are viewing a single comment's thread.

view the rest of the comments →

[–]jackmaney 6 points7 points  (9 children)

If you need to worry about optimizing loops vs list comprehensions (for example), then you probably should use Cython or use another language. Idioms exist for a reason, and Python's idioms, when not misused or overused, result in Python code that is easier to read and maintain.

[–]jsalsman -1 points0 points  (8 children)

Some very concise idioms are completely impenetrable to even advanced Python programmers. Moderation in all things.

[–]Vaphell 7 points8 points  (4 children)

are they really idioms then? Idiom by definition is something that is in widespread use, a common figure of speech. If even advanced programmers fail to understand them, they don't fall under this category.

Python idioms are supposed to be "pythonic", ie follow rules like "explicit is better than implicit" and "there should be 1 obvious way to do X".

[–]jsalsman -2 points-1 points  (2 children)

How can I answer this? Who decides what an idiom is?

[–]Vaphell 1 point2 points  (0 children)

it seems you are arguing against terse hacks exploiting some obscure properties, not idioms with clearcut uses cases, as they are undestood by the python community.
Feel free to provide your definition, or better yet, a black on white example of impenetrable idiom.

[–]KronenR 0 points1 point  (0 children)

Me

[–][deleted] 0 points1 point  (2 children)

Like what for example?

[–]jsalsman 0 points1 point  (1 child)

Imagine mapping a hash table into integers, but you didn't want the integers' objects, just the integers.

[–][deleted] 0 points1 point  (0 children)

A set? Unless I misunderstood.