calling the function police

EP EP at zomething.com
Mon Dec 22 06:46:31 CET 2003


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'

What rule have I violated?
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