A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-August/028285.html below:

[Python-Dev] type categories

[Python-Dev] type categories [Python-Dev] type categoriesAndrew Koenig ark@research.att.com
24 Aug 2002 13:33:01 -0400
>>>>>> "Oren" == Oren Tirosh <oren-py-d@hishome.net> 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>       pass

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, ark@research.att.com, http://www.research.att.com/info/ark



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4