if in expression

Fredrik Lundh fredrik at pythonware.com
Mon Aug 18 10:31:58 CEST 2008

John Machin wrote:

> There is an even more unreadable hack (due to Tim Peters IIRC) that
> avoides the false-then problem:
> (cond and [then_value] or [else_value])[0]

The correct attribution is "due to Tim Peters (who wishes it was Steve 


More information about the Python-list mailing list