condition and True or False

John Machin sjmachin at lexicon.net
Sun May 2 20:42:27 EDT 2010


On May 3, 9:14 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:

> If it is any arbitrary object, then "x and True or False" is just an
> obfuscated way of writing "bool(x)". Perhaps their code predates the
> introduction of bools, and they have defined global constants True and
> False but not bool. Then they removed the True and False bindings as no
> longer necessary, but neglected to replace the obfuscated conversion.

Or perhaps they are maintaining code that must run on any 2.X. True
and False would be set up conditional on Python version. Writing
"expression and True or False" avoids a function call.




More information about the Python-list mailing list