Are ABCs an anti-pattern?

D

Demian Brecht

I don't use them anymore, but I'm curious about others opinions on this
list...

The more time I spend in Python, discovering what "Pythonic" code is and
such, it seems that I throw away much in terms of academic learnings as
far as "OOP correctness" goes. In doing so, I find that, in general,
overall LOC (yes, I'm aware that this is a poor metric to judge anything
on), readability and overall quality of code seems to go up. Yes, you
give the user much more rope to hang themselves with making the general
assumption that the user knows what they're doing, but we're all
consenting adults here after all, right? ;)

As an example, I initially had an OAuth 2.0 client library that was
roughly 450 LOC (using ABCs, adapter patterns for the various flows,
etc). Dropping this for a more "Pythonic" (at least, what my
interpretation of Pythonic code is) brought the entire library down to
55 LOC. Having said that, the decline in LOC and overall grok-ability
wasn't entirely due to moving away from ABCs and dropping the use of
adapters, but it did have quite a bit to do with it).

As such, I see ABCs as somewhat of an anti-pattern in the Python world.
The concept is obviously essential in non-duck-typed language using
strict OOP, but does it *really* belong in Python?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top