Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

Please explain the bug here on the bug tracker, people shouldn't have to drill 
down into the PR to find out what it means.

Before fixing the bug, you should find out whether or not it actually is a bug. 
In my testing, the comment is approximately correct:

    py> from random import random
    py> d = dict((random(), None) for i in range(20))
    py> sys.getsizeof(d)
    432
    py> while sys.getsizeof(d) == 432:
    ...     d[random()] = None
    ...
    py> sys.getsizeof(d)
    816


That looks closer to double than triple to me. Try a larger dict:

    py> for i in range(10000):
    ...     d[random()] = None
    ...
    py> sys.getsizeof(d)
    196656
    py> while sys.getsizeof(d) == 196656:
    ...     d[random()] = None
    ...
    py> sys.getsizeof(d)
    393264

Still looks like double to me.

Unless an expert on the dict internals agrees with you, the comment is correct, 
it is not a bug, and this issue should be closed.

----------
nosy: +steven.daprano

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38637>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to