[Python-Dev] type categories
24 Aug 2002 13:33:01 -0400
>>>>>> "Oren" == Oren Tirosh <email@example.com> writes:
Oren> I would like to be able to declare that I need an object
Oren> with a specific interface even if the object was written
Oren> long before and I don't want to modify an existing library
Oren> just to make it conform to my interface names.
Nathan> class InterfaceWrapper(ExistingClass, AbstractInterfaceClass):
Nathan> I'm not saying this is a good idea :), but I believe this problem is
Nathan> already solvable in the current language.
Not quite. You are creating a new class with the desired property,
but it can sometimes be desirable to assert properties about
types that already exist.
For example, suppose I invent a GroupUnderPlus property for
types for which the + operator has group properties. I would
like to be able to say that int has that property, and not
have to derive a new class from int in order to do so.
Andrew Koenig, firstname.lastname@example.org, http://www.research.att.com/info/ark