[Python-3000] Generic function PEP won't make it in time

Emin.shopper Martinian.shopper emin.shopper at gmail.com
Wed Apr 25 15:16:24 CEST 2007

I disagree. I think that B&D-ish enforcement of ABCs is the most important
feature of an ABC (with the option of being able to turn off enforcement on
a per-class basis).

Imagine you have a program that takes a long time to run. If you use
duck-typing or similar ideas you may watch the program run for hours or days
and then raise an AttributeError or NotImplemented error because a derived
class didn't implement a required method. With B&D-ish enforcement of ABCs,
you can automatically catch such problems as soon as the program starts.
This is a problem that I see no other good solution to. For long running
programs, unit-tests will also take a long time to run so the argument that
your unit-tests should catch such errors is no longer valid. Also, while
pylint and pychecker are great tools that could be used to catch such
errors, they must be run manually by the programmer and generally take a
long time to run (at least longer than the ABC implementation I have).

To reiterate, while I think the documentation and reflection benefits of
ABCs are nice, I don't think they are nearly as essential as enforcement.
For most of the use cases I've seen, you could just as easily read the
documentation or the source code or try a simple example to determine how to
implement an iterable or hashable that will play nice with other classes. In
contrast, ABC enforcement provides the real benefit of catching errors
before many hours of program runtime are wasted. Consequently, I'm +1 on B&D
in this case.

-Emin Martinian

On 4/25/07, Paul Moore <p.f.moore at gmail.com> wrote:
> On 25/04/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> > Do we really need to have B&D-ish enforcement of abstract
> > method implementation? It doesn't seem pythonic to me.
> > I might want to leave some methods of an ABC unimplemented
> > because I'm not intending to use them. I'd be annoyed if
> > I were prevented from doing that because of some theoretical
> > notion that they "should" be implemented.
> I agree - this whole discussion still sounds like things are getting
> overly strict.
> OTOH, in Greg's case maybe he should just not bother inheriting from
> the ABC. From what I hear, that shouldn't cause him any problems
> ("duck typing isn't going away" is the message I've heard). Of course,
> it's difficult to be sure without specific examples (on either side of
> the debate).
> Paul.
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe:
> http://mail.python.org/mailman/options/python-3000/emin.shopper%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20070425/860a297b/attachment.html 

More information about the Python-3000 mailing list