[Chicago] order of keyword arguments
ianb at colorstudy.com
Thu Feb 5 04:05:41 CET 2009
On Wed, Feb 4, 2009 at 12:07 PM, Igor Sylvester <igorsyl at gmail.com> wrote:
> Hi Everyone,
> Is there a way to obtain the order of keyword arguments in this example:
> def foo(**kargs):
> print kargs.items()
> The call foo(A=0, B=1) could print (('A', 0), ('B', 1)) or (('B', 1), ('A',
> Since dictionaries do not know about ordering, I can't obtain the order of
> keyword arguments by simply looking into kargs.
> Perhaps there is a way to introspect the function stack to get a hold of
> the order of the arguments. Does anyone know if this is possible?
Nah, it's not really possible. You could look back in the function stack,
find the line number, parse the line, try to resolve symbols to determine
which part of the code refers to your function... but really, no, no way to
Ian Bicking | http://blog.ianbicking.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Chicago