Re: is operator versus id() function

2013-04-06 Thread Nobody
On Fri, 05 Apr 2013 06:49:14 -0700, Candide Dandide wrote: > So, could someone please explain what exactly the is operator returns ? > The official doc says : > > The ‘is‘ operator compares the identity of two objects; the id() > function returns an integer representing its identity (currently >

Re: is operator versus id() function

2013-04-05 Thread Tim Delaney
On 6 April 2013 03:40, candide wrote: > Le vendredi 5 avril 2013 16:53:55 UTC+2, Arnaud Delobelle a écrit : > > > > > > You've fallen victim to the fact that CPython is very quick to collect > > > > garbage. > > > OK, I get it but it's a fairly unexpected behavior. > Thanks for the demonstrative

Re: is operator versus id() function

2013-04-05 Thread candide
Le vendredi 5 avril 2013 16:53:55 UTC+2, Arnaud Delobelle a écrit : > > You've fallen victim to the fact that CPython is very quick to collect > > garbage. OK, I get it but it's a fairly unexpected behavior. Thanks for the demonstrative snippet of code and the instructive answer. -- http

Re: is operator versus id() function

2013-04-05 Thread Arnaud Delobelle
On 5 April 2013 14:49, Candide Dandide wrote: > Until now, I was quite sure that the is operator acts the same as the id > builtin function, or, to be more formal, that o1 is o2 to be exactly > equivalent to id(o1) == id(o2). This equivalence is reported in many books, > for instance Martelli's