[Python-3000] Builtin iterator type
Nick Coghlan
ncoghlan at gmail.com
Mon Nov 20 10:23:42 CET 2006
Bill Janssen wrote:
>> 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.
>
> Huh? Andrew pointed to exactly one "drawback", the inability to
> disassociate an inherent characteristic of a type, its "typeness"
> (which he refers to as ability-signalling), from a type. I hardly see
> that as problematic.
>
> Am *I* missing something?
Class inheritance implies a transitive relationship: if A is a B and B is a C,
then A is also a C. Not all characteristics of a type are necessarily
transitive in this fashion, so there are some things which cannot be
effectively expressed by means of class inheritance.
Consider the classic example of a taxonomy of birds and the expression of the
property "this bird can fly" in a world containing emus, penguins and ostriches.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list