paul bedaride wrote:
I also wonder if we need this two things, and if that is not two way to explain
the same semantic.

Changing the metaclass can lead to some fundamental changes to the way a class operates. Class decorators are for simpler things which don't require major changes to the class, and, in particular, things which shouldn't automatically be inherited by subclasses.

The specific motivating example in the python-dev thread linked from PEP 3129 was a class registry where being a subclass of an already registered class didn't necessary imply that the subclass should also be registered. This semantic is painful to implement using a metaclass, but trivial with a class decorator.

"Should subclasses implicitly inherit this behaviour" is actually a pretty decent rule of thumb for deciding whether something should be handled with a metaclass or a class decorator.

Cheers,
Nick.

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

Reply via email to