[Python-3000] PEP 3100 Comments
Phillip J. Eby
pje at telecommunity.com
Wed May 10 04:17:32 CEST 2006
At 06:48 PM 5/9/2006 -0700, Bill Janssen wrote:
>Using mixins, you'd do something like:
>
> class adapted_mytype (sequential_ordering, mytype):
> def len(self):
> return self.nitems()
>
>You can now use "adapted_mytype", which respects both the
>"sequential_ordering" protocol and the "mytype" protocol. And a user
>can use isinstance to test for that, avoiding "duck typing".
And as I pointed out already, this doesn't allow a third party to use one
library's types in the context of another without monkeypatching.
If I understand your proposal correctly, this approach doesn't do anything
beyond what Java does, and is inferior to already-available adaptation and
interface systems for today's Python.
More information about the Python-3000
mailing list