A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-March/125015.html below:

[Python-Dev] py2.7: dictobject not properly resizing

[Python-Dev] py2.7: dictobject not properly resizing [Python-Dev] py2.7: dictobject not properly resizingAntoine Pitrou solipsis at pitrou.net
Sat Mar 30 22:37:01 CET 2013
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.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4