Behaviour-based interface/protocol implementation?
Alan Franzoni
mailing at franzoni.eu
Thu Jan 27 16:12:45 EST 2011
On Thu, Jan 27, 2011 at 8:58 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> When you signature check, do you mean counting the number of arguments, or
> actually checking argument types?
In order to check for argument types I should either assume type
annotation (python 3 only, optional) or parse the docstring for the
method, which might not be available or be out of sync.
I just want to check for method name, number and/or names of the
arguments. It might not be trivial in python because the very same
argument can be passed either as a positional or a kw argument, so
def method1(self, a, b):
...
def method1(self, c, d):
...
could satisfy or not the very same interface, depending whether the
args are passed as postional or kw.
--
Alan Franzoni
--
contact me at public@[mysurname].eu
More information about the Python-list
mailing list