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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to