is implemented with id ?

Franck Ditter franck at ditter.org
Wed Sep 5 09:19:47 EDT 2012


Thanks to all, but :
- I should have said that I work with Python 3. Does that matter ?
- May I reformulate the queston : "a is b" and "id(a) == id(b)"
  both mean : "a et b share the same physical address". Is that True ?
Thanks,

    franck

In article <mailman.213.1346827305.27098.python-list at python.org>,
 Benjamin Kaplan <benjamin.kaplan at case.edu> wrote:

> 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