News for hackers. Stuff that matters.
Re:Python List Comprehensions Explained Visually by sdrothrock on Wednesday December 02, 2015 @08:53PM (#10667229)
One basic misstep here for me is a comparison of why list comprehensions are better than loops -- speed, ease of reading, etc. There are a lot of comparisons, but no discussion of WHY list comprehensions.

I work on a project that's written mostly in Python; on occasion, other coworkers have to edit/work with my code and they're not used to Python at all, so I find myself writing for loops instead of list comprehensions for clarity.

Re:Python List Comprehensions Explained Visually by TheCowboy on Wednesday December 02, 2015 @11:50PM (#10667817)
I find the utility of list comprehensions is maximized when I'm in a Python shell and dealing with indentation when writing a loop can become obnoxious to edit. I tend to have a Python shell tab open in my terminal throughout the day, and it's nice to bang out a quick loop in a one-liner.

When writing actual code, I tend to stick with regular for loops.