Mark McEahern wrote:
Dan Eloff wrote:
How can you determine that func2 will only accept
bar and zoo, but not foo and call the function with
bar as an argument?

Let Python answer the question for you:

... <good explanation of how to do this for simple functions.>

Please be aware the "normal" way to do this is go ahead and call the function. Many "function wrapping" techniques will fail this test, and often the code that looks into the guts of a call in order to do "something clever" will fail when it is pointed at anything that uses the technique.

Not only does curry:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549

not show you what args it accepts, but decorators, a Python 2.4
invention, will typically obscure the interface of the decorated
function.  Since they wrap _any_ function call, they typically
take the most general arguments possible in order to accommodate
the widest range of functions to wrap.

--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to