Counterintuitive Python behavior

Brian Quinlan brian at sweetapp.com
Wed Apr 17 12:40:15 EDT 2002


Skip wrote:
>     Greg>     3 eq 3
>     Greg>     not (3 eq 4)
>     Greg>     a eq a            # PROVIDED a HAS A VALUE
>     Greg>     "foo" eq "foo"
>     Greg>     not ([] eq [])
>     Greg>     not ({} eq {})
>     Greg>     () eq ()
> 
> Guido's time machine strikes again:
> 
>     >>> 3 is 3
>     True

This is an implementation accident.

>>> a = 100000
>>> b = 100000
>>> a is b
0

I think that Greg's proposed operator would return true in this case.

Cheers,
Brian






More information about the Python-list mailing list