descriptor dilemma
Sébastien Boisgérault
Sebastien.Boisgerault at gmail.com
Wed May 4 13:00:06 EDT 2005
Jeff Epler wrote:
> > >>> id(c.f) == id(C.__dict__['f'].__get__(c,C))
> > True
>
> Here, c.f is discarded by the time the right-hand-side of == is
> executed. So the object whose id() is being calculated on the
> right-hand-side could turn out to be the same, since the two objects
> have disjoint lifetimes.
Understood. I guess I was influenced by C++ where a temporary survives
up to the end of the complete statement in which it was created. Right
?
SB
More information about the Python-list
mailing list