Guido van Rossum wrote:
> On 4/7/06, Walter Dörwald <[EMAIL PROTECTED]> wrote:
>> An Interface is an abstract class that you subclass to make it a
>> concrete implementation.
> 
> That's not the view of most people who use the word interface these
> days. Not in Zope (see Fred Drake's post), not in Java.
> 
>> If you have an adapter that adapts to the
>> FooInterface why shouldn't it return a FooInterface object?
> 
> Because implementing an interface and extending a class are separate concepts.
> 
> Did you forget duck typing? Something can be a sequence without
> subclassing a common base class.

</lurk>

I'm curious what effect overloaded functions will have on duck typing; a 
Something can act like a list, but from my understanding of the 
discussion* it won't end up matching:

@pprint.register(list)
def pprint_list(obj):
     pass

It seems to me that now to get a duck-typed list, not only do you have 
to implement all of special methods that define "listy-ness," you also 
have to find the overloaded functions that are specialized for lists, 
and register your own implementation (or an implementation specialized 
for lists, if appropriate).

If a consumer of your listy class is also a consumer of some separate 
overloaded functions that operate on lists, will they be responsible for 
registering your listy class into the overloaded functions?  How does 
that work when the overloaded functions are an implementation detail of 
the other library they happen to use?

I think there's a lot of interesting potential here; but the reliance on 
object type seems to imply that you can't mix it with duck typing, and 
I'm not sure if that's being fully considered.

Eli

* - I haven't been able to read all of the posts on this topic, but I've 
tried to skim the threads as deeply as I'm able.  Sorry if this has been 
brought up already.

<lurk>

_______________________________________________
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