<story><title>Show HN: Inside Python Dict – an explorable explanation</title><url>https://just-taking-a-ride.com/inside_python_dict/</url></story><parent_chain><item><author>stinos</author><text>&lt;i&gt;Python lists are actually arrays — contiguous chunks of memory.&lt;/i&gt;&lt;p&gt;Just wondering here, is this guaranteed to always be the case? Practically it probably is, but does the Python spec (as in: the laguage, not one of it&amp;#x27;s implementations) say a list must be implemented using contiguous memory of slots with Python objects? That seems so low-level and C-ish. Or does the OP actually mean &lt;i&gt;CPython&lt;/i&gt; here for instance?</text></item></parent_chain><comment><author>mcguire</author><text>Does Python actually have a spec? AFAIK, it&amp;#x27;s always been &amp;quot;what CPython does.&amp;quot;&lt;p&gt;IIRC, an old joke was that Python lists are arrays and Perl arrays are lists.</text></comment>
<story><title>Show HN: Inside Python Dict – an explorable explanation</title><url>https://just-taking-a-ride.com/inside_python_dict/</url></story><parent_chain><item><author>stinos</author><text>&lt;i&gt;Python lists are actually arrays — contiguous chunks of memory.&lt;/i&gt;&lt;p&gt;Just wondering here, is this guaranteed to always be the case? Practically it probably is, but does the Python spec (as in: the laguage, not one of it&amp;#x27;s implementations) say a list must be implemented using contiguous memory of slots with Python objects? That seems so low-level and C-ish. Or does the OP actually mean &lt;i&gt;CPython&lt;/i&gt; here for instance?</text></item></parent_chain><comment><author>lozenge</author><text>Python doesn&amp;#x27;t really have a spec in the way that, say, C# does. The docs are missing things like whether the argument is positional-only, exact exceptions raised in all cases, and time complexity of common operations.&lt;p&gt;That said, I think every implementation uses contiguous memory. PyPy has list &amp;quot;strategies&amp;quot; int[], double[] and PyObject[] and probably more, switching transparently between them.</text></comment>