PEP 3119 ABC - And how I learned to love the Abstract Bomb

Pykler hnassrat at gmail.com
Tue May 25 23:41:08 EDT 2010


On May 13, 9:30 am, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> You’re looking at it wrong. If you want to force people to do things in a
> certain way, use Java. Python is about enabling things, not forcing them.

LoL :-)

> Don’t use subclassing. Instead, let the caller pass you a duck-typed object
> that implements the methods you need.

I totally agree. in my code I do not force the object to be an
instance of a subclass of the ABC, they certainly can duck-type as
they please. The ABC is simply there to give them an idea of what
methods they need to implement. It is kind of self documenting
structure if you may. However, I had this problem described earlier
which does not let me complete this self documenting structure without
adding a thorough doc-string explaining that they still need to
implement one or two more methods.



More information about the Python-list mailing list