A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/020808.html below:

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

[Python-Dev] For review: PEP 285: Adding a bool type [Python-Dev] For review: PEP 285: Adding a bool typeGuido van Rossum guido@python.org
Fri, 08 Mar 2002 17:09:27 -0500
> I didn't want to jump on the bandwagon, but...
> 
> It occurs to me that one potential benefit of having a
> boolean type is to avoid mistakes like this:
> 
> test = value & MASK
> if test == True:
>     DoSomething()
> 
> Sure, "if bool(test) == True:" does the right thing, but
> so does "if test:". You wouldn't have made the mistake
> in the first place if you'd thought of that. :-)
> 
> I think at least add something like this should be added
> to the description in the PEP:
> 
>     def __cmp__(self,other):
>         return int.__cmp__(self,bool(other))

Absolutely not.  I want True == 2 to be False.

--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