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.

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to