[Python-Dev] PEP 285: Adding a bool type (original) (raw)
Guido van Rossum guido@python.org
Fri, 05 Apr 2002 11:21:44 -0500
- Previous message: [Python-Dev] PEP 285: Adding a bool type
- Next message: [Python-Dev] PEP 285: Adding a bool type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> No - I was benchmarking with the patch posted on Sourceforge (before > PEP285 was checked into CVS), patched into a CVS snapshot taken at > the same time. > > Casting to bool using (x and True) or (x or False) : 1.61 > Casting to bool using (bool) : 2.68 > Flow control on explicit True : 1.42 > Flow control on explicit 1 : 0.99 > Flow control on variable bound to True : 1.02 > Flow control on variable bound to 1 : 0.99
time to make keywords out of True, False (and None)?
None should be a keyword, yes. Patch anyone?
Making True and False keywords would cause unnecessary breakage of legacy code that defines its own bools and names them True or False. We might be able to do this after a few more releases, after we've added warnings for assignment to them.
I kind of doubt that calls to bool() or code saying "if True" (or "return True" or "x = True") is in the critical path of anything.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] PEP 285: Adding a bool type
- Next message: [Python-Dev] PEP 285: Adding a bool type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]