[Python-ideas] Preserving **kwargs order
Terry Reedy
tjreedy at udel.edu
Fri Apr 4 10:54:07 CEST 2014
This proposal strikes me as conceptually disordered. A set is not
ordered. An ordered set would be a sequence, and if you want a sequence,
the best thing is to use a sequence object. A dict is a set of
key,value pairs. If you want an ordered sequence of key, value pairs,
use a sequence. OrderedDicts were added for situations where that is not
possible because a pre-existing api requires a mapping object, even
though you might prefer to use a sequence.
Passing a sequence of key,value pairs is a case that requires a mapping.
If a function attends to the order of key,value pairs it receives, it
should receive a sequence of such.
**kwds in a call is a substitute for writing out unordered key=value
specifications. The function may or may not have **kargs in its
signature and if it does, the kargs received may or may not be equal to
the kwds passed.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list