[Python-Dev] PEP 285: Adding a bool type

Andrew Koenig ark@research.att.com
04 Apr 2002 10:16:36 -0500

>> On a side note, writing 'i or False and True' performs much better
>> than bool(i) in the test implementation, and flow control statements
>> involving ints are perform much better than flow control using bool.
>> Will there be a performance degredation in the final version, or can
>> this be avoided?

Guido> That surprises me.  Can you show your benchmark?

Doesn't 'i or False and True' always evaluate to 'i', rather than to
'bool(i)' because 'and' binds more tighly than 'or'?

What's the corresponding performance measure for 'i and True or False'?

Andrew Koenig, ark@research.att.com, http://www.research.att.com/info/ark