is possible to get order of keyword parameters ?

Duncan Booth duncan.booth at invalid.invalid
Sat Jan 26 13:48:15 CET 2008


rndblnch <rndblnch at gmail.com> wrote:

> On Jan 25, 9:01 pm, Duncan Booth <duncan.bo... at invalid.invalid> wrote:
>> rndblnch <rndbl... at gmail.com> 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?

You have to ask?

Because either you always initialise your Point with parameters in the same 
order, in which case just use positional parameters which is cleaner 
anyway, or when you have a function f(somePoint) you also need to know 
whether it takes a Point(width,height) or a Point(height,width) and if you 
get it wrong your code breaks.



More information about the Python-list mailing list