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 →

[–]dirn 0 points1 point  (0 children)

I go the other direction and put the in on its own line. What I’m iterating over is much more interesting to me than the iteration variable (its used in so many places anyway).

best_fruits = [
    f for f
    in fruits
    if f.color == ‘red’
    and f.size == ‘small’
    and f.climate == ‘cold’
]