if does not evaluate
Dan Bishop
danb_83 at yahoo.com
Sun Jun 6 06:07:00 EDT 2004
More information about the Python-list mailing list
Sun Jun 6 06:07:00 EDT 2004
- Previous message (by thread): if does not evaluate
- Next message (by thread): if does not evaluate
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jim Newton <jimka at rdrop.com> wrote in message news:<2if8daFmdreiU1 at uni-berlin.de>... > how do you put an if or a for inside a lambda? I'm not quite sure what you'd expect "for" to evaluate to, but you might want to take a look at list comprehensions: [expr(var) for var in seq if cond(var)] For "if", you can write "(F, T)[bool(C)]" or "(C and [T] or [F])[0]". The latter has the advantage of short-circuiting.
- Previous message (by thread): if does not evaluate
- Next message (by thread): if does not evaluate
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list