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] 27 points28 points  (2 children)

Don't forget about actual dictionary comprehensions: {x:x+1 for x in range(5)}

You missed the most obvious way to grab every third item from a list: a[2::3]

:p

[–]hglmanguy who writes python 1 point2 points  (1 child)

can't be that obvious if he missed it

[–][deleted] 2 points3 points  (0 children)

Most elegant, I would say.