> >> One question: do True/False behave like None, particularly WRT "is"? > > Guido> That depends on what the meaning of "is" is. (*) > > Guido> Yes, there will be only one True and one False. That's what the > Guido> _create flag on the __new__ method was trying to suggest. > > Hmmm... A boolean type can only take on two values. I presume you > will expose True and False through builtins. Yes. > Why would you need a __new__ method or any notiong of "creation"? __new__ must exist in order to support writing bool(some_expression) __new__ returns a reference to the existing False or True object, except when it is called in the special internal-only mode that is needed to bootstrap False and True. The __new__ code should really be just this: def __new__(cls, val=0, _create=0): if val: return True else: return False except the Python version must be able to create the instances True and False. (Hm, there's another way to create them: False = int.__new__(bool, 0) True = int.__new__(bool, 1) I'll change the PEP to use this.) --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4