<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 18, 2014 at 10:27 AM,  <span dir="ltr"><<a href="mailto:random832@fastmail.us" target="_blank">random832@fastmail.us</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><br>
<br>
On Thu, Dec 18, 2014, at 11:18, Wes Turner wrote:<br>
> > 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>
><br>
> Something like DefaultOrderedDict (like defaultdict)?<br>
><br>
> From <a href="http://bugs.python.org/issue16991#msg232825" target="_blank">http://bugs.python.org/issue16991#msg232825</a> :<br>
><br>
> > Would this make it easy/faster to also have a DefaultOrderedDict<br>
> > (which can/could also be accomplished with<br>
> > .get(attr, []) and .setdefault(attr, [])?<br>
<br>
</span>Really, I'm thinking more along the lines of a dict that only guarantees<br>
enumeration order (no integer indexed access) in the specific cases<br>
where people "need" it (ordered kwargs for e.g. the OrderedDict<br>
constructor would be another example), while being 'lightweight' enough<br>
(in terms of not having a lot of extra machinery dedicated to<br>
maintaining the order) to ultimately be used as the real dict<br>
implementation (and therefore usable for kwargs, class dictionaries,<br>
etc)</blockquote><div><br></div><div>I understand. More like the function of DEFAULT_PREDICATE_ORDERING</div><div>here: <a href="https://github.com/westurner/healthref/blob/gh-pages/healthref.py#L100">https://github.com/westurner/healthref/blob/gh-pages/healthref.py#L100</a> .</div><div><br></div><div>That would indeed be useful. What would you call it?</div><div><br> <br></div></div></div></div>