On Sun, May 18, 2008 at 8:36 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: >>> It's why a want to know how to express the class decorator for making a >>> comparison > > [Georg] >> >> A class decorator works exactly like a function decorator, that is, >> >> @foo >> class X: ... >> >> is equivalent to >> >> class X: ... >> X = foo(X) >> >> This should be all you need to know in order to write a class decorator. > > I concur.
Technically, that's true, but an example wouldn't hurt. Examples also help understanding the motivation. Even the difference between class decorators and metaclasses could be explained with examples. (E.g. a metaclass that auto-registers its classes vs. a class decorator that registers a class.) -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com