[Python-Dev] User's complaints (original) (raw)

Armin Rigo arigo at tunes.org
Mon Jul 17 20:22:35 CEST 2006


Hi Jeroen,

On Thu, Jul 13, 2006 at 02:02:22PM +0200, Jeroen Ruigrok van der Werven wrote:

He doesn't specifically need the builtin types to be extendable. It's just nice to be able to define a single class in multiple modules.

There are various simple ways to do this; the one I'm using from time to time is the "extendabletype" metaclass from:

http://codespeak.net/svn/pypy/dist/pypy/annotation/pairtype.py

Example:

class A: metaclass = extendabletype def f(...): ...

Somewhere else:

class extend(A): def g(...): ...

FWIW the above 30-lines file also contains a fast double-dispatch multimethod implementation :-)

A bientot,

Armin



More information about the Python-Dev mailing list