Alan Franzoni wrote:
Hello,
I'd like to have a system which lets me do certain actions if the
duck-type of a certain objects matches what I expect, i.e. I'd like to
have a formalization of what it's sometimes done through getattr()
calls:

if getattr(myobj, "somemethod", None) is not None:
    myobj.somemethod(somevalue)
[...]
I'd like to do a kind of runtime-check for signatures. Of course there
couldn't be an absolute certainty of interface implementation, because
a runtime dynamic proxy method (accepting *args and **kwargs in its
signature, as an example)  might  just fool my signature check.

When you signature check, do you mean counting the number of arguments, or actually checking argument types?

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

Reply via email to