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

Yes, this would do exactly the same as bool(2).
but: 2 == True would be False
Just as in C99 (the new updated C standard, not yet in actual use).
For the first time, we'll have a standard way to cast an arbitrary value to a normalized truth value. Currently we write "not not x" for that. Now *that* is ugly. Also, you'll be able to use 'is' and 'is not', as follows: if bool(x) is True: ... if bool(y) is not True: ... Not that I endorse this (I still think that anybody who takes a boolean result and then compares it to True is crazy), but it reads like English. :-) --Guido van Rossum (home page: http://www.python.org/~guido/)

"GvR" == Guido van Rossum <guido@python.org> writes:
GvR> For the first time, we'll have a standard way to cast an GvR> arbitrary value to a normalized truth value. Currently we GvR> write "not not x" for that. Now *that* is ugly. That's a huge benefit I hadn't thought of. I use that idiom often because it's a cheap substitute for the lack of a ?: statement. But it does confound a lot of people! -Barry

"GvR" == Guido van Rossum <guido@python.org> writes:
GvR> For the first time, we'll have a standard way to cast an GvR> arbitrary value to a normalized truth value. Currently we GvR> write "not not x" for that. Now *that* is ugly. That's a huge benefit I hadn't thought of. I use that idiom often because it's a cheap substitute for the lack of a ?: statement. But it does confound a lot of people! -Barry
participants (2)
-
barry@zope.com
-
Guido van Rossum