[Python-3000] Builtin iterator type

Jan Grant jan.grant at bristol.ac.uk
Sun Nov 19 12:48:35 CET 2006


On Sat, 18 Nov 2006, Andrew Koenig wrote:

> Now, suppose that every type that signals the presence of an ability
> inherits from "ability".  Then we've just broken the whole ability system.
> Because if "iterator" inherits from "ability" and every iterator type
> inherits from "iterator", then every iterator is also able to signal the
> presence of an ability--and we most definitely do not want that!

> Am I missing something?

I believe you have a type error in this argument.

Instance x of class X has ability A, you suggest, should be indicated by
having X derive from signalling_class(A). That's is-a: All Xs are 
signalling_class(A)s. Then sc(A) is the class of objects with 
ability A.

You want to indicate that sc(A) is a class that signals an ability. You 
suggest you do this by having sc(A) derive from a base class, 
sc(Signals_Abilities).

That is a type error: to indicate that sc(A) is an ability-signalling 
class, your original convention is that sc(A) should be an _instance_ of 
sc(Signals_Abilities). That is not represented by an inheritance 
relationship between sc(A) and sc(Signals_Abiliities), but by a 
membership relationship.

So, sc(Signals_Abilities) is actually a metaclass, I think.

jan

-- 
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661   http://ioctl.org/jan/
Spreadsheet through network. Oh yeah.


More information about the Python-3000 mailing list