'is not' or '!='

Tim Chase python.list at tim.thechases.com
Tue Aug 19 13:34:00 EDT 2014


On 2014-08-19 20:29, Marko Rauhamaa wrote:
> The "is" relation can be defined trivially through the id()
> function:
> 
>    X is Y iff id(X) == id(Y)
> 
> What remains is the characterization of the (total) id() function.
> For example, we can stipulate that:
> 
>    X = Y
>    assert(id(X) == id(Y))

Note that a lifetime can be less than a statement:

$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> id([1,2,3]) == id([4,5,6])
True


-tkc





More information about the Python-list mailing list