calling the function police

vincent wehren vincent at visualtrans.de
Mon Dec 22 01:26:54 EST 2003


"EP" <EP at zomething.com> schrieb im Newsbeitrag
news:mailman.28.1072071996.684.python-list at python.org...
| Hi,
|
| "I'm new and confused"
| "Hello 'New and Confused'"
|
| TypeError: function1() got multiple values for keyword argument 'first'
|
|  >>> def function1 (first='Jimminy Cricket', end='suffix', *extras):
| together, extra=' ',' '
| for each in extras:
| try:
| extra+=each
| except TypeError:
| extra+=`each`
| together=first+extra+end
| return together
|
|  >>> parameter='something'
|
|  >>> result=function1(first=parameter, end='noodles','Jim Beam', 'Poker')
|
| TypeError: function1() got multiple values for keyword argument 'first'

I would expect you to get something like "SyntaxError: non-keyword arg after
keyword arg" (at least in 2.3.x).

Vincent Wehren


|
| What rule have I violated?


I would expect you to get something like "SyntaxError: non-keyword arg after
keyword arg" (at least in 2.3.x).

Vincent Wehren




| This seems to be associated with the assignment of a variable to a keyword
| argument in the function call.  Is this illegal?
| If so, why is this a crime?  The logic isn't popping out at me...
|
| Thanks....
|
|
| Eric
|
| [I resorted to relying on order rather than keywords in the call to make
it
| work]
|
|
|






More information about the Python-list mailing list