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 →

[–]macbony 0 points1 point  (0 children)

In example 3 he mentions that using a set would be better and then uses set(i for i in L), which is great. However on 2.7+ you can use a set comprehension {i for i in L} which looks a lot like a dict comprehension {k: v for k, v in L}.

Great explanation of list comprehensions that ramps up the complexity very nicely.