[Python-ideas] check interfaces, isducktype(X, A)
Nick Coghlan
ncoghlan at gmail.com
Wed Dec 4 13:20:56 CET 2013
On 4 December 2013 18:19, Andrew Barnert <abarnert at yahoo.com> wrote:
> I don't understand what you mean here. ABCs can check methods. They do so at
> runtime. You're free to define or not define any protocol you want.
>
> What you have to add is checking the argspecs of the methods rather than
> just their names. That's a great idea, but it's a much better idea as an
> addition to what's already there than as a complete parallel API to very
> similar functionality. And if this were added to the stdlib, I'm pretty sure
> it would be a modification/extension of the abc module, not a competing and
> similar but not identical module.
It should also be based on the rich function inspect.signature API
(introduced in http://www.python.org/dev/peps/pep-0362/), not on the
older low level interfaces (the function signature API has been
backported to Python 2.x as the funcsigs module on PyPI).
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list