<div dir="ltr"><div>Sigh. I couldn't figure out how to get GMail to fake its way into a thread for emails I never got. How embarrassing.<br><br>Was trying to reply in this thread:<br><a href="https://mail.python.org/pipermail/python-ideas/2014-April/027454.html" target="_blank">https://mail.python.org/pipermail/python-ideas/2014-April/027454.html</a><br>
<br></div>Anyway, I understand that Raymond Hettinger is implementing a better dict that would inadvertently be ordered (<a href="https://mail.python.org/pipermail/python-dev/2012-December/123028.html">https://mail.python.org/pipermail/python-dev/2012-December/123028.html</a>). I am just wondering about whether the hashing algorithm or internal shape of the automatic dictionary could be improved given what the interpreter can guarantee about the keyspace.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 14, 2014 at 10:20 PM, Franklin? Lee <span dir="ltr"><<a href="mailto:leewangzhong+python@gmail.com" target="_blank">leewangzhong+python@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Would string interning help?<br><br></div>As in, all keywords in a **pack have to be strings. All parameter names can be interned (if they're not already). The **pack can be a special dict optimized for strings (more specifically: identifiers), with an order-preserving overhead. (And then **unpacking would be smart about the type of thing being unpacked.)<br>
<div><div><br>I understand that there would need to be a C proof-of-concept that
this could act like a dict on the Python level, and maybe even beat a dict for **kwargs performance. I'm not suggesting that it's viable, but I haven't seen a mention of taking advantage of the restrictions on the keys, and while I personally got stuck trying to flesh out an algorithm and structure for it (unnecessary(?) overhead on extracting some keys and passing on the rest while preserving order), maybe someone more clever can figure out how to work it.<br>
</div></div></div>
</blockquote></div><br></div>