Brano Zarnovican wrote:

> Q: Can you call 'f' with keywords that will be
>  ignored, without changing 'f's definition ?

no.

> I would like to avoid code like this:
> k = {}
> k['optional'] = 2
> try:
>  f(1, **k)
> except TypeError:
>  f(1)

why would you write code like this?  what's the use case?

> 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).

you can use reflection mechanisms to check the target function
signature, but I won't tell you how to do that until you show me
a reasonable use case ;-)

</F> 



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to