[Tutor] Need better understanding of **kwargs
Eduardo Vieira
eduardo.susan at gmail.com
Sat Jun 6 19:44:05 CEST 2009
Hello, I thought I understood **kwargs until I stumbled with this function:
def changeflexion(myword, mytag, **dicty):
global er_verbs
global ar_verbs
global ir_verbs
# global dicty
for item in dicty:
if myword in item and mytag in item[1]:
if dicty[item].endswith('ar'):
ending = item[0].replace(dicty[item][:-2], "")
try:
return dicty[item][:-2] + ar_verbs[ending]
except KeyError:
return item[0]
elif dicty[item].endswith('er'):
ending = item[0].replace(dicty[item][:-2], "")
try:
return dicty[item][:-2] + er_verbs[ending]
except KeyError:
return item[0]
elif dicty[item].endswith('ir'):
ending = item[0].replace(dicty[item][:-2], "")
try:
return dicty[item][:-2] + ir_verbs[ending]
except KeyError:
return item[0]
else:
return item[0]
but when I import the module and call:
a = conjugate.changeflexion('estaban', 'VLFin', conjugate.mydict)
I get this error:
TypeError: changeflexion() takes exactly 2 arguments (3 given)
Isn't the 3rd argument supposed to be a dictionary?
Thanks for all the help this list has provided me as a novice
More information about the Tutor
mailing list