[Python-3000] Abilities / Interfaces

Andrew Koenig ark-mlist at att.net
Wed Nov 22 19:37:06 CET 2006


> I think it would also be great if we had "ability
> algebra" whereby you could state that a given ability A is composed of
> existing abilities A1 and A2, and every object or class that already
> has A1 and A2 will automatically be considered to have A.

Yes!

> However, I do *not* want to go the way of duck typing here -- if an
> ability A claims that it is implemented by method foo(), and an object
> x has a foo() method but doesn't explicitly claim to have ability A
> (and neither does its class), then testing x for A should return
> false.

Also yes.

> I think this deviates from Haskell, which seems to be big on
> structural type equivalence (?).

How so?

> So I think Python needs to do its own thing here, to some extent.

Yup.  That's part of why I like the term "ability" -- one isn't tempted to
think it means the same thing as the corresponding term in another language.




More information about the Python-3000 mailing list