About the implementation of del in Python 3

Dan Wissme wissme at free.fr
Fri Jul 7 03:29:37 EDT 2017


Le 06/07/2017 à 20:56, Nathan Ernst a écrit :
> In Python, "==" is not a reference equality operator (and I hate Java for
> their misuse of the operator), so I absolutely disagree with using the Java
> description to describe Python's "==" operator, primarily because, well,
> it's wrong. Simple example:
>
> With Python 3.5.2 (should hold for any version 2.4 or greater):
>>>> a = 1
>>>> b = 1
>>>> a == b
> True
>>>> a is b
> True
>>>> c = 1000
>>>> d = 1000
>>>> c == d
> True
>>>> c is d
> False

Strange behavior in Python 3.6.0
 >>> i = 3000
 >>> j = 3000
 >>> i is j
False
 >>> n = 4000 ; m = 4000 ; n is m
True

       dan






More information about the Python-list mailing list