Are ABCs an anti-pattern?

Demian Brecht demianbrecht at gmail.com
Wed Oct 3 12:35:26 EDT 2012


>
>
> ABCs were added (fairly recently) in 3.0 for the reasons given in
> http://python.org/dev/peps/**pep-3119/<http://python.org/dev/peps/pep-3119/>
> It was expected that it would take awhile for them to see good, pythonic
> uses. We obviously did okay without them up to 2.7.
>

I read the PEP before posting just to make sure that I wasn't missing
anything. The gut feeling that I got after reading PEP 3119 was that it was
written by an academic relatively recently out of school (or in school
even), or coming from a strictly typed language who saw this as a hole in
the language.

Don't get me wrong. In theory (and coming from a C/C++ background), I fully
appreciate the need for such language features. However, in practice, it
seems to somewhat be contrary to the Zen of Python.

One thing that irks me a bit about abc's is that those coming from other
(strictly typed) language backgrounds (or school for that matter) will
think "hey, my prof/books told me that I should use an abstract base class
to define the contract for [x]". Next step, Google abstract base classes
and Python, they're presented with abcs, rather than how to look and think
about the problem differently using Pythonic idioms. This kind of thing
(imho) is a catalyst for many over-engineered Python packages and
misunderstanding of the core language.

In short, it seems like somewhat of an academic crutch to me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121003/c83adb4c/attachment.html>


More information about the Python-list mailing list