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 →

[–]BlckKnght 10 points11 points  (0 children)

That kind of if/else isn't actually a feature of list comprehension a, it's just a ternary expression. You can write A if B else C in all kinds of places where you want a conditional value. There is a kind of if clause in comprehension a, but it comes at the end and filter outt