Re: is possible to get order of keyword parameters ?

2008-01-26 Thread Duncan Booth
rndblnch [EMAIL PROTECTED] wrote: On Jan 25, 9:01 pm, Duncan Booth [EMAIL PROTECTED] wrote: rndblnch [EMAIL PROTECTED] wrote: the following example should also work: size = Point(width=23, height=45) w, h = size So you want the unpacking to depend on how the Point was initialised!

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread rndblnch
On Jan 25, 9:01 pm, Duncan Booth [EMAIL PROTECTED] wrote: rndblnch [EMAIL PROTECTED] wrote: the following example should also work: size = Point(width=23, height=45) w, h = size So you want the unpacking to depend on how the Point was initialised! Aaargh! why not? in def f(*args):

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread rndblnch
On Jan 25, 5:27 pm, Larry Bates [EMAIL PROTECTED] wrote: Keyword arguments are normally treaded as order independent. Why do you think you need to find the order? What problem do you wish to solve? -Larry On Jan 25, 7:39 pm, Duncan Booth [EMAIL PROTECTED] wrote: The question remains, what

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread Duncan Booth
rndblnch [EMAIL PROTECTED] wrote: (sorry, draft message gone to fast) i.e. is it possible to write such a function: def f(**kwargs): skipped return result such as : f(x=12, y=24) == ['x', 'y'] f(y=24, x=12) == ['y', 'x'] what i need is to get the order of the keyword

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread Marc 'BlackJack' Rintsch
On Fri, 25 Jan 2008 05:49:40 -0800, rndblnch wrote: def f(**kwargs): skipped return result such as : f(x=12, y=24) == ['x', 'y'] f(y=24, x=12) == ['y', 'x'] what i need is to get the order of the keyword parameters inside the function. any hints ? Impossible. Dictionaries

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread Steven Bethard
Steven Bethard wrote: rndblnch wrote: my goal is to implement a kind of named tuple. idealy, it should behave like this: p = Point(x=12, y=13) print p.x, p.y but what requires to keep track of the order is the unpacking: x, y = p i can't figure out how to produce an iterable that returns

is possible to get order of keyword parameters ?

2008-01-25 Thread rndblnch
i.e. is it possible to write a function def f(**kwargs): return -- http://mail.python.org/mailman/listinfo/python-list

is possible to get order of keyword parameters ?

2008-01-25 Thread rndblnch
(sorry, draft message gone to fast) i.e. is it possible to write such a function: def f(**kwargs): skipped return result such as : f(x=12, y=24) == ['x', 'y'] f(y=24, x=12) == ['y', 'x'] what i need is to get the order of the keyword parameters inside the function. any hints ? thanks,

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread Larry Bates
Keyword arguments are normally treaded as order independent. Why do you think you need to find the order? What problem do you wish to solve? -Larry rndblnch wrote: (sorry, draft message gone to fast) i.e. is it possible to write such a function: def f(**kwargs): skipped

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread Duncan Booth
rndblnch [EMAIL PROTECTED] wrote: the following example should also work: size = Point(width=23, height=45) w, h = size So you want the unpacking to depend on how the Point was initialised! Aaargh! -- http://mail.python.org/mailman/listinfo/python-list

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread Steven Bethard
rndblnch wrote: my goal is to implement a kind of named tuple. idealy, it should behave like this: p = Point(x=12, y=13) print p.x, p.y but what requires to keep track of the order is the unpacking: x, y = p i can't figure out how to produce an iterable that returns the values in the right