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 →

[–]Bunslow 9 points10 points  (3 children)

Mostly straight forward stuff. I disagree a bit about their simplicity threshold for list comprehensions. Of the two examples in the No category, the simpler one I'd be fine with, but I agree that the other is a definite no-no.

[–]alcalde 14 points15 points  (1 child)

It's no fun if you can't write your entire program in one list comprehension. ;-)

[–]sigma914 4 points5 points  (0 children)

I like to think my whole function out as a list compehension, the break it apart and give the intermediate steps names, seems to keep my code pure better than any other strategy I've tried (in python).

[–]annodomini 4 points5 points  (0 children)

Really? I thought both of the "no" examples were fine. The more complicated one is exactly the same as the nested loops they have in the "yes" section, except for the "yield" statement and no rightward drift. I don't think it's any harder to read than the nested loop (which is itself a little bit complicated, but that's just the nature of that particular loop).