Hacker News new | ask | show | jobs
by marcstreeter 3392 days ago
maybe it's bad form but I generally prefer to break my list/dictionary/set comprehensions into various lines. For me it increases the readability

    foo = [
        if condition(bar) transform(bar) else other_transform(bar) # 1: storage
        for bar in base.list() # 2: iteration
        if bar_tester(bar). # 3: filtering
    ]

to each his own I suppose, until the PEP8 police come and get us all!!!