B
Brano Zarnovican
Hi !
If I define 'f' like this
def f(a):
print a
then, the call with keywords
f(1, optional=2)
fails. I have to change 'f' to
def f(a, **kwrds):
print a
to ignore optional parameters.
BUT..
Q: Can you call 'f' with keywords that will be
ignored, without changing 'f's definition ?
I would like to avoid code like this:
k = {}
k['optional'] = 2
try:
f(1, **k)
except TypeError:
f(1)
Also, the problem is that I don't know if the TypeError
was caused by calling 'f' with keywords or somewhere
"inside" f.
You can also say that I need to specify optional parameters
on caller side (not called side).
BranoZ
If I define 'f' like this
def f(a):
print a
then, the call with keywords
f(1, optional=2)
fails. I have to change 'f' to
def f(a, **kwrds):
print a
to ignore optional parameters.
BUT..
Q: Can you call 'f' with keywords that will be
ignored, without changing 'f's definition ?
I would like to avoid code like this:
k = {}
k['optional'] = 2
try:
f(1, **k)
except TypeError:
f(1)
Also, the problem is that I don't know if the TypeError
was caused by calling 'f' with keywords or somewhere
"inside" f.
You can also say that I need to specify optional parameters
on caller side (not called side).
BranoZ