Result of ``a is b''

Axel Boldt axelboldt at yahoo.com
Wed Mar 17 18:27:04 EST 2004


"Terry Reedy" <tjreedy at udel.edu> wrote 

> "Axel Boldt" <axelboldt at yahoo.com> wrote

> > "is" on immutables would be useful. Why would anybody ever want to
> > know whether two strings or tupels are internally stored at the same
> > location, other than to deduce details of the Python implementation?
> 
> Deducing details of the implementation *is*, for people with a certain
> curiosity, a legitimate usage, in spite of your distain for such.

No disdain whatsoever, I do it all the time myself. However, even
after my proposed redefinition of "is" for immutables, the function
id() would remain available for the curious.

> Explaining the bahavior of
> 
> a=[1]
> b=a
> a[0]=2
> print b
> 
> is another use for 'is'.

Certainly, and there are many other real world use cases for "is",
just not for "is" on immutables.

Axel



More information about the Python-list mailing list