[Python-ideas] Why does BoundArguments use an OrderedDict?

Antony Lee antony.lee at berkeley.edu
Thu Dec 18 03:15:37 CET 2014

The discussion has drifted towards improving OrderedDict (something I
certainly approve), but the semantic question is still there: why should
BoundArguments.arguments be ordered by the parameter order?  For example,
the recipe just below in the docs, for filling in the remaining default
arguments, breaks that ordering, without even mentioning that.


2014-12-17 16:37 GMT-08:00 Nick Coghlan <ncoghlan at gmail.com>:
> On 18 December 2014 at 07:26, Eric Snow <ericsnowcurrently at gmail.com>
> wrote:
> >> - does it have to inherit from dict? that looks like a potential can of
> >>   worms
> >
> > One of the constraints here is to make the C implementation of
> > OrderedDict match the API of the Python type exactly and the
> > underlying implementation as closely as reasonable.  The Python type
> > subclasses dict so the C implementation does as well.
> This kind of design rationale is potentially useful to include inline
> as a block comment. The kinds of questions reviewers have are often
> going to be the same kinds of questions future maintainers have, and
> "why" data regarding core architectural decisions is less likely to go
> out of date as future maintainers make changes.
> > FWIW (and not directed to Antoine specifically), the implementation up
> > for review may not be ideal, but it exists and is complete. :)
> > Barring any substantial concerns during review (and the points Antoine
> > has brought up), I would rather the patch landed than wait
> > indefinitely for a more ideal implementation.  That could happen
> > afterward, though I'm fairly confident in the correctness and
> > efficiency of the implementation.
> Aye, a definite +1 for "better" over "perfect".
> Cheers,
> Nick.
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20141217/3921a2a7/attachment-0001.html>

More information about the Python-ideas mailing list