integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

Stephen Hansen me+list/python at ixokai.io
Sun Jul 11 21:33:33 EDT 2010


On 7/11/10 5:51 PM, rantingrick wrote:
> On Jul 11, 7:23 pm, Steven D'Aprano <st... at REMOVE-THIS-
> cybersource.com.au> wrote:
>> On Sun, 11 Jul 2010 16:22:41 -0700, rantingrick wrote:
>>> On Jul 11, 1:19 pm, Mark Dickinson <dicki... at gmail.com> wrote:
>>
>>>> Okay.  What fix do you propose?  Would your fix maintain the identity
>>>> "0 == False"?
>>
>>> No because all integers should bool True. An integer is a value that IS
>>> NOT empty
>>
>> Integers aren't containers, the concept of "empty" or "full" doesn't
>> apply to them.
> 
> And again you failed to follow along with the thread so you have no
> idea where my statements is projected from. Of course integers are NOT
> containers in the way a list or dict is a container! My remark was a
> rebuff of comments made by Stephen earlier.

I forgot to reply to that; an integer is certainly not empty.

But 0 is nothing.

Its not empty vs full. Its nothing vs something that determines if
something is considered true-ish or not.

>> Nevertheless, what is done is done, and now you have to deal with it.
>> Just wishing that it was never done is not dealing with backwards
>> compatibility, and breaking existing code is not an acceptable option.
> 
> Yea and if Guido would have taking your defeatist attitude we'd all be
> using braces for scope!

Guido made a new language.

You should go do that.

Feel free to define it however you want.

In Python, the meaning of "truth" goes back a very, very, very long way.
It isn't going to change. Every once in awhile people hate it. For
awhile after True/False were introduced, some people wanted to go modify
things to a boolean strictness. But in the end, its all pointless.

This is just how it works. Its not going to change. It would break
thousands and thousands of lines of code. There's not going to be
another major breakage for, oh, maybe ten years. Or twenty. If ever.

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20100711/79113628/attachment.sig>


More information about the Python-list mailing list