[Python-ideas] ABC: what about the method arguments ?

Nick Coghlan ncoghlan at gmail.com
Thu Sep 23 23:42:12 CEST 2010

On Fri, Sep 24, 2010 at 2:18 AM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> I think it goes further than documentation at this point. ABC is
> present and used in the stdlib, not the doc.
> So asking a class about its capabilities is a feature we provide for
> third-party code.

Minor nit - we can only ask a fairly limited subset of questions along
these lines (i.e. does *this* class/instance implement *this* ABC?).
More interesting questions like "which ABCs does this class/instance
explicitly implement?" are currently impossible (see

Back on topic - I like Guido's approach. While we can debate the
merits of LBYL signature checking forever without reaching agreement
(for the record, my opinion is that static checks should be thought of
as a bunch of implicit unit tests that you get "for free"), providing
a way to explicitly request ABC signature checks in the abc module
probably isn't a bad idea. If nothing else, invoking that check can
become a recommended part of the unit test suite for classes that
claim to implement ABCs. Is getting the method signatures right
*sufficient* for ABC compliance? No. Is it *necessary*? Yes. It's the
latter point that makes this feature potentially worth standardising.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list