Skip to content

Comment on Python does support if-else in lambdas...parent

Comments

Along with the points other people have made,

    trueaction if condition else falseaction
is marginally more clear than
    condition and trueaction or falseaction
, at least to people who aren't used to seeing and/or used like that. A lot of people, especially newer programmers, aren't used to seeing and...or used for branching that directly.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.