PEP 285: Adding a bool type

Magnus Lie Hetland mlh at vier.idi.ntnu.no
Sun Mar 31 18:50:51 EST 2002


In article <roy-F52402.08143430032002 at news1.panix.com>, Roy Smith wrote:
>What should the following examples print?
>
>>>> print {} == False
>>>> print {} is False
>
>I'm convinced the second one should print "False", but I'm not really sure 
>about the first.  I also assume that

This is dealt with in the PEP. {} != False.

>>>> print False is not True
>
>should print "True"?

Of course. (Or 1, if str(True) ends up being "1".)

>For those thinking ahead to obfuscated Python contests, I can see having 
>lots of fun with this.  The following, for example, is a valid Python 
>program under this PEP:
>
>False is not True is not "False is not True"

How is this any more or less obfuscated than

0 is not 1 is not "0 is not 1"

?

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org



More information about the Python-list mailing list