[Python-Dev] py2.7: dictobject not properly resizing
Antoine Pitrou
solipsis at pitrou.net
Sat Mar 30 22:37:01 CET 2013
More information about the Python-Dev mailing list
Sat Mar 30 22:37:01 CET 2013
- Previous message: [Python-Dev] py2.7: dictobject not properly resizing
- Next message: [Python-Dev] py2.7: dictobject not properly resizing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 30 Mar 2013 17:31:26 -0400 Micha Gorelick <mynameisfiber at gmail.com> 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.
- Previous message: [Python-Dev] py2.7: dictobject not properly resizing
- Next message: [Python-Dev] py2.7: dictobject not properly resizing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list