For compelling, I think the code smell put off by the "no conflict" metaclass generator recipe (which also appeared in Alex Martelli's PyCon talk) is fairly compelling from a duck typing point of view.
# would you rather class K: __metaclass__ = no_conflict(MetaA, MetaB) # or @decoA @decoB class K: pass
Actually, it's possible today with:
class K: decoB() decoA()
As long as decoA() and decoB() use the "class advisor" mechanism I built for Zope and PyProtocols.
That mechanism basically sticks a custom __metaclass__ into the enclosing class, and implements a simple protocol for chaining subsequently-defined class advisors. See 'protocols.advice' in PyProtocols or 'zope.interface.advice' in Zope or Twisted for details.
Anyway, I'm not certain that moving these functions up to decorator status will really do anything useful; you can already put them near the top of the class definition, such that they're relatively prominent.
_______________________________________________ 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