Author inada.naoki
Recipients inada.naoki
Date 2017-04-11.09:39:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1491903560.12.0.959603376514.issue30040@psf.upfronthosting.co.za>
In-reply-to
Content
dict.clear() make the dict to empty key-sharing dict to reduce it's size.
New dict can use same technique.

$ ./python.default 
Python 3.7.0a0 (heads/master:6dfcc81, Apr 10 2017, 19:55:52) 
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> d = {}
>>> sys.getsizeof(d)
240
>>> d.clear()
>>> sys.getsizeof(d)
72

$ ./python.patched 
Python 3.7.0a0 (heads/master-dirty:6dfcc81, Apr 11 2017, 18:11:02) 
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getsizeof({})
72
History
Date User Action Args
2017-04-11 09:39:20inada.naokisetrecipients: + inada.naoki
2017-04-11 09:39:20inada.naokisetmessageid: <1491903560.12.0.959603376514.issue30040@psf.upfronthosting.co.za>
2017-04-11 09:39:20inada.naokilinkissue30040 messages
2017-04-11 09:39:19inada.naokicreate