id( ) function question

Laszlo Nagy gandalf at shopzeus.com
Thu Oct 15 18:01:28 CEST 2009


> The built-ins aren't mutable, and the singletons are each immutable
> and/or unique; so in no case do objects that are both different and
> mutable have the same ID.
>   
I know. :-)
> Although I have no idea how it is that `id({}) == id({})` as a prior
> posted showed; FWIW, I can't manage to reproduce that outcome.
>   
Yes, that was the question. I mean, I thought that the id() function can 
be used to tell if two mutable objects are different or not. But 
apparently it cannot. Then why is it there, and what is it for?



More information about the Python-list mailing list