[Python-ideas] OrderedDict for kwargs and class statement namespace

Guido van Rossum guido at python.org
Thu Feb 28 19:56:51 CET 2013


But __prepare__ only works for classes, not for methods, right?

On Thu, Feb 28, 2013 at 10:02 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> On 1 Mar 2013 03:34, "Guido van Rossum" <guido at python.org> wrote:
>>
>> Hm. I write code regularly that takes a **kwargs dict and stores it
>> into some other longer-lasting datastructure. Having that other
>> datastructure suddenly receive OrderedDicts instead of plain dicts
>> might definitely cause some confusion and possible performance issues.
>> And I don't recall ever having wanted to know the order of the kwargs
>> in the call.
>>
>> But even apart from that backwards incompatibility I think this
>> feature is too rarely useful to make it the default behavior -- if
>> anything I want **kwargs to become faster
>
> And PEP 422 is designed to make it easier to share a common __prepare__
> method with different post processing.
>
> Cheers,
> Nick.
>
>>
>> On Thu, Feb 28, 2013 at 2:15 AM, Eric Snow <ericsnowcurrently at gmail.com>
>> wrote:
>> > Just wanted to put out some feelers for the feasibility of these two
>> > features:
>> >
>> > * have the **kwargs param be an OrderedDict rather than a dict
>> > * have class definitions happen relative to an OrderedDict by default
>> > rather
>> > than a dict, and still overridable by a metaclass's __prepare__().
>> >
>> > Both of these will need OrderedDict in C, which is getting close (issue
>> > #16991).
>> >
>> > -eric
>> >
>> >
>> > _______________________________________________
>> > Python-ideas mailing list
>> > Python-ideas at python.org
>> > http://mail.python.org/mailman/listinfo/python-ideas
>> >
>>
>>
>>
>> --
>> --Guido van Rossum (python.org/~guido)
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> http://mail.python.org/mailman/listinfo/python-ideas



--
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list