On Sat, 30 Mar 2013 17:31:26 -0400
Micha Gorelick <[email protected]> wrote:
> I was taking a look at dictobject.c and realized that the logic
> controlling whether a resizedict will occur in
> dict_set_item_by_hash_or_entry disallows for the shrinking of a
> dictionary. This is contrary to what the comments directly above say:
Also in 3.4:
>>> d = {i: i for i in range(1000)}
>>> sys.getsizeof(d)
49264
>>> for i in range(900): del d[i]
...
>>> sys.getsizeof(d)
49264
>>> for i in range(900, 1000): del d[i]
...
>>> sys.getsizeof(d)
49264
>>> len(d)
0
>>> d.clear()
>>> sys.getsizeof(d)
88
Regards
Antoine.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com