[Python-3000] Builtin iterator type

Nick Coghlan ncoghlan at gmail.com
Sun Nov 19 05:00:00 CET 2006


Andrew Koenig wrote:
> In other words, whether or not we choose to define a family of types that
> stand for particular abilities, I think we should not use inheritance as the
> mechanism for specifying that a particular class has a particular ability.
> I don't know what the mechanism should be, but it shouldn't be inheritance.
> 
> Am I missing something?

It seems to me to be an excellent write-up of why using concrete classes for 
interface definitions is potentially problematic. (Although I will point out 
that most  protocols for things like len() *do* involve checks for special 
methods by name, and the check for iterability is typically a non-destructive 
call to iter(x), rather than a destructive one to x.next()).

To make multiple dispatch practical, I suspect we will end up with something 
more along of the lines of Zope.interface to 'formalise' Python interface 
definitions.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list