Delaney, Timothy C (Timothy) wrote:
class factory:

    @register
    def __call__(self):
        pass

Just as an additional data point - obviously not applicable in all
cases.

Yep, and it's obviously possible to do that now with just function decorators. Getting my head around what that actually *does* is a little trickier, though (as near as I can tell, it will register a standalone function named __call__, with nothing linking it to the containing class).


What a class decorator allows is the registration of the whole process of invoking the metaclass and hence __new__ and __init__ as a single unit.

Anyway, I don't particularly feel the lack of class decorators, but I thought I should mention this (perhaps small) category of non-transforming decorators as a situation where class decoration would make more sense to me than using a metaclass.

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
_______________________________________________
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