conditional expressions

Delaney, Timothy tdelaney at avaya.com
Mon Sep 23 02:31:39 EDT 2002


> From: Bruce Dawson 
> 
> Basically, construct a two entry list of the two items and then index 
> that with your expression, converted to bool. The bool function is 
> essential since there was previously no generic way of getting the 
> true/false value of an expression.

Ignoring everything such as short-circuiting ...

This type of thinking is one very good reason why bool() is a Good Thing
(TM). A large number (my guess is the majority) of Python users do not know
about operator.truth().

Tim Delaney




More information about the Python-list mailing list