[Python-ideas] Collect **kw arguments as an ordered dictionary

Michael Foord fuzzyman at gmail.com
Fri Apr 17 23:00:55 CEST 2009

Hello all,

It would be nice if **kw arguments collected in a function / method
signature were collected as an ordered dictionary rather  than ordinary

Main use case, currently (I believe) the odict constructor doesn't guarantee
to preserve ordering if created with keyword arguments:

    odict(key=value, key2=value, key3=value)

My use case - I'd like to preserve the ordering to reproduce exactly the
order of arguments for the Mock module representation of the objects are
used. Because the order of iterating over arguments isn't the same as they
are passed in representations can't be compared in tests reliably across
Python versions / implementations.

All the best,

Michael Foord

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090417/324f82cf/attachment.html>

More information about the Python-ideas mailing list