[Python-3000] pep 3119 question (ABC)

Neal Becker ndbecker2 at gmail.com
Thu Jan 10 20:54:07 CET 2008

Guido van Rossum wrote:

> On Jan 10, 2008 11:20 AM, Neal Becker <ndbecker2 at gmail.com> wrote:
>> On reading this pep, I was not clear on one issue.
>> In some interface proposals (zope?), as well as in c++0x concept
>> proposal, there is a mechanism to specify how to adapt a given class to
>> satisfy given interface requirements.
>> For example, suppose container ABC requires a 'size'.  Suppose I have a
>> container-like class C, but it's size is called 'len'.  The idea is to be
>> able to specify, _outside of the class C_, that the size requirement is
>> met, and it's called 'len'.
>> Does pep 3119 offer that functionality?
> No.

Isn't that rather limiting then?  It's all well and good to design a
monolithic library with a uniform use of concepts.  But the motivation for
adaptation is that you want to mix libraries from different sources that
might not have coordinated in their design.

Is this because python classes are always open, and so I can always
add/modify their properties to conform to any interface, even without
touching the library source code, and therefore I don't really need any
other mechanism to adapt interfaces?

More information about the Python-3000 mailing list