On Sat, Oct 24, 2009 at 3:35 PM, Sidharth Kuruvila <[email protected]> wrote: > Hi Anand. > >> Looks like Python dictionary implementation is doing something clever. >> d.keys() returns the cached object if its refcount == 1 and returns a >> new object if refcount > 1. >> > > I don't think that's what's happening > >>>> id(d.keys()) > 535168 >>>> id(d.keys()) > 535168 >>>> l = [1,2,3,4] >>>> id(d.keys()) > 542640 > > It seems that when d.keys is called the second it's using the same > memory as the previous call as that one was deleted. Creating a list > displaces the memory.
Hmm.. I think you are right. Anand _______________________________________________ BangPypers mailing list [email protected] http://mail.python.org/mailman/listinfo/bangpypers
