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.

Regards,
Sidharth
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to