On Tue, Jun 25, 2013 at 4:38 PM, Mark Janssen <dreamingforw...@gmail.com> wrote: > Sorry my last message got sent prematurely. Retrying... > >> So instead of super(), you would have sub()? It's an interesting >> concept, but I don't think it changes anything. You still have to >> design your classes cooperatively if you expect to use them with >> multiple inheritance. > > Yes, and let new instances of the child classes automatically ensure > the contracts of the parent classes -- managed within the Python > interpreter, not the developer.
It sounds like you want to be using Eiffel, not Python. > As for sub(), I suppose it could be called delegate(). You can call it that, but you'll just be muddying the waters since there's already a perfectly good pattern by that name, which involves having multiple distinct objects and has nothing to do with inheritance. > The issue of classes cooperating isn't as big as it seems, because > since you're working now from a useful, agreed-upon common base (the > non-negotiable, but also non-arbitrary) machine types, you're now all > (the python and ideally the *object* community) speaking the same > language. Who's going to argue about integers (as the atomic type) > and sets (as the most basic grouping type) being THE common set of > bases for everything else? I mean, it doesn't get anymore ideal and > pure than integers and sets. Combining integers with sets I can make > a Rational class and have infinite-precision arithmetic, for example. I don't see how this solves anything. At some point you have to be able to add methods and attributes to your objects. For example, your Rational class is going to need some sort of "reduce" method to reduce a Rational instance to lowest terms. That's not a method that belongs on an integer or set type. If you can't add functionality, then all you will ever have are integers and sets, and if you can add functionality, then what difference does it make what your fundamental base class is? >From a programming perspective, I think it is proper that "object" is the most fundamental base class, because all it has is identity. Integers and sets add other functionality on top of that. -- http://mail.python.org/mailman/listinfo/python-list