<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dict on Shai Asher</title><link>https://slow-is-smooth.io/tags/dict/</link><description>Recent content in Dict on Shai Asher</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Sun, 14 Apr 2019 09:00:00 +0300</lastBuildDate><atom:link href="https://slow-is-smooth.io/tags/dict/index.xml" rel="self" type="application/rss+xml"/><item><title>Dicts All the Way Down</title><link>https://slow-is-smooth.io/blog/dicts-all-the-way-down/</link><pubDate>Sun, 14 Apr 2019 09:00:00 +0300</pubDate><guid>https://slow-is-smooth.io/blog/dicts-all-the-way-down/</guid><description>&lt;p&gt;A Python 3.7 dict holding a million integers is 41,943,144 bytes. Delete every key and it is still&#10;41,943,144 bytes. Add one key back and it&amp;rsquo;s the same. The dict has no entries left, but it keeps&#10;the table it grew for a million, and the only way to get the memory back is to copy it: &lt;code&gt;dict(d)&lt;/code&gt;&#10;is 240 bytes. That is one of several things about dicts that the language doesn&amp;rsquo;t say and the C&#10;code decides, and dicts matter more than any other structure in CPython, because the interpreter is&#10;built out of them: module globals, class namespaces, instance attributes and keyword arguments are&#10;all dicts.&lt;/p&gt;</description></item></channel></rss>