Does '!=' equivelent to 'is not'
gagsl-py2 at yahoo.com.ar
Wed Jun 18 09:45:54 CEST 2008
En Tue, 17 Jun 2008 23:04:16 -0300, Asun Friere <afriere at yahoo.co.uk> escribió:
> On Jun 17, 5:33 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
>> En Tue, 17 Jun 2008 02:25:42 -0300, Lie <Lie.1... at gmail.com> escribió:
>> > Basically 'a is b' and 'not(a is b)' is similar to 'id(a) == id(b)'
>> > and 'not(id(a) == id(b))'
>> ... The above statement is not. A counterexample:
>> py>  is 
>> py> id()==id()
> But that's not what he said, he used 'a' and 'b' which are names, not
> anonymous objects.
> Fairer would be,
> a = ;b = 
> id(a) == id(b)
If you limit yourself to interpret 'a' and 'b' as actual names, yes, the statement is true. But I thought of them as placeholders or metasyntactic names - like in "abs(x) returns the absolute value of x", where x may represent *any* expression, not just a single name. Under this general interpretation the statement is not true anymore.
(This thread is getting way above 10000cp...)
More information about the Python-list