On 15 Jan 2008, at 15:37, Guido van Rossum wrote:
> Second, a "metaclass" to add a number of methods (or other attributes)
> to an existing class, using a convenient class notation:
...
> class <newclass>(<someclass>):
> __metaclass__ = monkeypatch_class
> def <method1>(...): ...
> def <method2>(...): ...
> ...
In Objective-C it's perfectly common to extend existing classes using
'categories' and I have often found this idiom very useful. What is
described here is basically categories for Python. I've implemented
something like this before and I would be happy to see this added to
the standard library and formalised.
Nicko
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com