is this a bug?

Volucris volucris at hotmail.com
Wed Aug 15 19:09:10 EDT 2001


>>> id('+=')
21928320
>>> id('+=')
21933232
>>> a = '+='
>>> id(a)
21933216
>>> b = '+='
>>> id(b)
21926144
>>> c = a
>>> id(a)
21933216
>>> id(c)
21933216
>>> a is c
1
>>> a is b
0

--

Volucris (a) hotmail.com
"Eu não falo uma única palavra do português."

"Vassilis Virvilis" <vasvir at iit.demokritos.gr> wrote in message
news:3B7AF5AA.977B331C at iit.demokritos.gr...
> I am using python 2.1 in Redhat Linux.
> Do you find anything irrational to the following session?
> >>> a='+='
> >>> a is a
> 1
> >>> a is '+='
> 0
> ^^^^^^^^^^^^^
> >>> a = 'dsd'
> >>> a is 'dsd'
> 1
> >>> '+=' is '+='
> 1
> >>>
>
> I apologize if this has been brought to the attention of this group
before.
> Maybe I did misunderstand the use of the 'is' operator, but then how it is
> supposed to work?
>
> .Bill





More information about the Python-list mailing list