[Python-Dev] type categories
Tue, 27 Aug 2002 00:51:51 +0300
On Mon, Aug 26, 2002 at 05:17:28PM -0400, Andrew Koenig wrote:
> >> Remember that one thing I consider important is the ability to claim
> >> that classes written by others belong to a category defined by me. I do not
> >> want to have to modify those classes in order to do so.
> Oren> How about union(int, long, float, has_marker("TotallyOrdered")) ?
> How about it? There is still the question of how to make such claims.
> Oren> Inheritance of implementation also inherits the form (methods
> Oren> and call signatures). If you don't go out of your way to modify
> Oren> it a subclass will usually also be a subcategory so this should
> Oren> be pretty transparent most of the time.
> Right. So how do you define a subclass that you do not want to be
> a subcategory?
If you make an incompatible change to a method call signature it will just
happen by itself. If that's what you meant - good. It that wasn't what you
meant this serves as a form of error checking.
It gets harder if you want to remove a method or marker. The problem is
that there is currently no way to mask inherited attributes. This will
require either a language extension that will allow you to del them or
using some other convention for this purpose.