On Sat, 18 May 2013 22:47:35 -0700 Guido van Rossum <gu...@python.org> wrote: > On Sat, May 18, 2013 at 10:27 PM, Raymond Hettinger > <raymond.hettin...@gmail.com> wrote: > > BTW, I'm +1 on the idea for ordering keyword-args. It makes > > it easier to debug if the arguments show-up in the order they > > were created. AFAICT, no purpose is served by scrambling them > > (which is exacerbated by the new randomized hashing security feature). > > I'm slow at warming up to the idea. My main concern is speed -- since > most code doesn't need it and function calls are already slow (and > obviously very common :-) it would be a shame if this slowed down > function calls that don't need it noticeably. > > An observation is that it's only necessary to preserve order if the > function definition uses **kwds. AFAIK we currently don't know if this > is the case when the call is made though, but perhaps the information > could be made available to the call site somehow. > > There are also many special cases to consider; e.g. using **kwds in > the call where kwds is an unordered dict, or calls from C, or calls to > C. > > But maybe someone considers this a challenge and comes up with a > patch? The benefits to *some* use cases would be obvious.
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. Changing keyword arguments to be an OrderedDict without impacting performance in all the cases you mentioned (and without breaking C-level compatibility) would be a real, tough challenge. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com