is implemented with id ?

Benjamin Kaplan benjamin.kaplan at case.edu
Wed Sep 5 02:40:33 EDT 2012


On Tue, Sep 4, 2012 at 11:30 PM, Franck Ditter <franck at ditter.org> wrote:
> Hi !
> a is b <==> id(a) == id(b) in builtin classes.
> Is that true ?
> Thanks,
>
>     franck

No. It is true that if a is b then id(a) == id(b) but the reverse is
not necessarily true. id is only guaranteed to be unique among objects
alive at the same time. If objects are discarded, their ids may be
reused even though the objects are not the same.



More information about the Python-list mailing list