[Python-Dev] Ordering keyword dicts
Joao S. O. Bueno
jsbueno at python.org.br
Sun May 19 17:22:54 CEST 2013
On 19 May 2013 11:57, Guido van Rossum <gvanrossum at gmail.com> wrote:
> Hm. Wouldn'tvevery call site be slowed down by checking for that flag?
Actually, when I was thinking on the subject I came to the same idea, of having
some functions marked differently so they would use a different call mechanism -
but them I wondered around having a different opcode for the ordered-dict calls.
Would that be feasible?
> Sent from Mailbox
> On Sun, May 19, 2013 at 7:42 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> On Sun, May 19, 2013 at 11:01 PM, Antoine Pitrou <solipsis at pitrou.net>
>> > The main use case seems to be the OrderedDict constructor itself.
>> > Otherwise, I can't think of any situation where I would've wanted it.
>> I've had a couple related to populating other mappings where order
>> matters, at least from a predictability and readability perspective,
>> even if it's not strictly required from a standards compliance point
>> of view (think writing XML attributes, etc).
>> I quite liked the idea of a simple flag attribute on function objects
>> that the interpreter checked, with a decorator in functools (or even
>> the builtins) to set it. It's not a particularly elegant solution, but
>> it would get the job done with minimal performance impact on existing
>> Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
>> Python-Dev mailing list
>> Python-Dev at python.org
> Python-Dev mailing list
> Python-Dev at python.org
More information about the Python-Dev