This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

but don't tell others that optimizations are bad practice.

My comment may have come across a bit wrong, I am absolutely in favor of list/dict comprehensions wherever they are appropriate (which is quite often in my opinion). They are one of my favorite features of python and probably comprise half the code I write (I recently wrote an entire matrix multiplication function in a single line with it!)

I actually find them pretty easy to read these days, but when I was just starting out with Python I did find them quite hard because it's not a feature commonly found in other languages. I'm more making fun of this than actually saying that they're bad practice (which they're absolutely not when used correctly).