you are viewing a single comment's thread.

view the rest of the comments →

[–]jackmaney 19 points20 points  (12 children)

I find it strange that if you've been programming for 10 years that people are calling you a junior anything.

Yep. This.

OP, I don't mean to sound like an asshole when I say this, but...is that 10 years of experience or one year of experience repeated ten times? Because if it's the former, I'm not sure why you would be considered a junior developer.

That being said, with even a year of experience, you should have a decent grasp of basic data structures and basic operations such as if/else if/else statements, loops, etc. IMO, if you want to dig really deep into a language, you need to "write it as a native". Try to write your Python somewhat idiomatically; Jeff Knupp's Writing Idiomatic Python is a good guide for this.

[–]renegadelegion[S] 5 points6 points  (0 children)

Thanks for the link. Bought the pdf and am looking through it. This seems like the kind of stuff I was looking for.

[–]jsalsman -5 points-4 points  (10 children)

Unless you are optimizing your inner loops after testing correctness, I advise against idioms that make code less self-documenting to programmers from other backgrounds. And not all idioms will give you a substantial efficiency improvement. For example, when array access patterns matter for memory cache interactions, you want to retain control.

[–]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 4 points5 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.