[Python-3000] PEP for Metaclasses in Python 3000 (original) (raw)

Phillip J. Eby pje at telecommunity.com
Tue Mar 13 02:36:15 CET 2007


At 05:30 PM 3/12/2007 -0700, Guido van Rossum wrote:

I don't know about sealed, but using class attributes topassing parameter (other than the namespace itself) to the metaclass seems a pretty lousy mechanism, and keyword arguments in the classdef are a much cleaner solution for this need. For example, this solves the problem that those attributes remain in the class dict but aren't necessarily candidates for inheritance

Ah, I missed that point about the new kwargs mechanism! Before I was +0 on *args/**kw, now I'm +1. I've actually needed that feature more than once, but have been doing it with specialized in-body class decorators, like this:

 class FooService(context.Service):
     context.replaces(BarService)
     ...

Which could presumably now become:

 class FooService(context.Service, replaces=BarService):
     ...

Right?



More information about the Python-3000 mailing list