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

Don Spaulding donspauldingii at gmail.com
Wed May 15 04:56:13 CEST 2013


On Tue, May 14, 2013 at 9:07 PM, Ethan Furman <ethan at stoneleaf.us> wrote:

> On 05/14/2013 06:57 PM, Don Spaulding wrote:
>
>> On Tue, May 14, 2013 at 5:23 PM, Andrew Barnert <abarnert at yahoo.com<mailto:
>> abarnert at yahoo.com>> wrote:
>>
>>
>>     On May 14, 2013, at 12:53, Jonathan Eunice <jonathan.eunice at gmail.com<mailto:
>> jonathan.eunice at gmail.**com <jonathan.eunice at gmail.com>>> wrote:
>>
>>      Using a compatible, separate implementation for |OrderedDict| is a
>>> fine way to gracefully extend the language, but
>>>     it leaves ordering only half-accomodated. Consider:
>>>
>>>     OrderedDict(a=2,  b=3,  c=7)
>>>
>>>      If your proposal is to replace dict with OrderedDict, I think you
>> need at least one use case besides OrderedDict's
>>     constructor.
>>
>>
>> I don't understand the dismissal of OrderedDict.__init__ as an invalid
>> use case.
>>
>
> It's not being dismissed, but it's only one.  There are thousands of
> functions using **kwds that simply don't care about the order.  Should they
> all pay the performance price so that some tiny fraction can benefit?
>
> While it is correctly said that if performance is a Big Deal you shouldn't
> be using Python, we also are not interested in making it slower without a
> really good reason.
>

I'm of the opinion that the status quo is "fast, but kinda wrong".  Ideally
we'd have a "fast, and correct" implementation, but I'd settle for a
"negligibly slower, but still correct" implementation.  Nobody wants Python
3-dot-next to be slower, but how much slower are we really talking about
given that Raymond Hettinger recently proposed[0] a plain-old-dict
implementation that uses less space, performs better, and as an unintended
side-effect just happens to maintain its initial order?

Aside from the performance impact, isn't any code that relies on any
current ordering behavior of **kwargs broken by design?

[0]: http://mail.python.org/pipermail/python-dev/2012-December/123028.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130514/b9ae8b4b/attachment-0001.html>


More information about the Python-ideas mailing list