<div dir="ltr">> <span style="font-size:13px">Would it be reasonable to make a lightweight "predictable dict" class</span><br style="font-size:13px"><span style="font-size:13px">> that makes a weaker guarantee, e.g. that the enumeration order will</span><br style="font-size:13px"><span style="font-size:13px">> match the insertion order in the case where it is filled from empty with</span><br style="font-size:13px"><span style="font-size:13px">> no intervening deletions and not guaranteed in any other cases?</span><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">Something like DefaultOrderedDict (like defaultdict)?</span></div><div><span style="font-size:13px"><br></span></div><div>From <a href="http://bugs.python.org/issue16991#msg232825">http://bugs.python.org/issue16991#msg232825</a> :</div><div><br></div><div>> <span style="color:rgb(0,0,0);font-size:12px;line-height:17.8231201171875px;white-space:pre-wrap">Would this make it easy/faster to also have a DefaultOrderedDict </span></div><div><span style="color:rgb(0,0,0);font-size:12px;line-height:17.8231201171875px;white-space:pre-wrap">> (which can/could also be accomplished with</span></div><div><span style="color:rgb(0,0,0);font-size:12px;line-height:17.8231201171875px;white-space:pre-wrap">>  .get(attr, []) and .setdefault(attr, [])?</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 18, 2014 at 10:09 AM,  <span dir="ltr"><<a href="mailto:random832@fastmail.us" target="_blank">random832@fastmail.us</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Dec 18, 2014, at 02:05, Nick Coghlan wrote:<br>
> As far as I'm aware, it's an ordered dictionary because that makes the<br>
> default repr() predictable when binding arguments for a given function<br>
> (in the absence of after-the-fact manipulation like the example in the<br>
> docs that injects the default values as explicitly bound arguments).<br>
><br>
> The inspect.signature() machinery includes quite a few things like<br>
> that where the serialisation as a human readable string is considered<br>
> as important then the programmatic representation.<br>
<br>
</span>Would it be reasonable to make a lightweight "predictable dict" class<br>
that makes a weaker guarantee, e.g. that the enumeration order will<br>
match the insertion order in the case where it is filled from empty with<br>
no intervening deletions and not guaranteed in any other cases?<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div></div>