[Python-ideas] Let's be more orderly!

Tim Delaney timothy.c.delaney at gmail.com
Wed May 15 02:36:38 CEST 2013


On 15 May 2013 09:34, Steven D'Aprano <steve at pearwood.info> wrote:

>
> I don't think that is a particularly good analogy. Stable sorting is
> intuitively correct. Treating keyword args differently according to
> their order is intuitively the wrong thing to do, at least most of the
> time.
>

The argument *for* an ordered kwargs however is that same one that was used
for Enums iterating in definition order by default - it's an ordering that
can't be recovered once it's lost.

However, it's not a property that I think is absolutely necessary for
kwargs and we shouldn't lose performance to gain that property, but there
have been times when I would have liked it.

Barry created a new dict implementation a while back that as a side-effect
retained insertion order so long as no keys were removed. That would be
suitable IMO for kwargs as a guarantee - definition order so long as
nothing has been removed. It was discussed and there was the suggestion to
actively break this functionality in order to prevent people relying on it.
I'm not sure what the end result of the discussion was off the top of my
head.

Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130515/663f1ddc/attachment.html>


More information about the Python-ideas mailing list