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

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 13 11:04:07 CET 2007


Nick Coghlan wrote:

- is it intended to typically be a static method or a class method of the metaclass? (as it will be called before new, an instance method of the metaclass wouldn't make sense)

Looks like it will have to be either a staticmethod or classmethod, or else you'll have to give your metaclass a metametaclass and make it an instance method of that.

Maybe this is another case for an implicitly-static method, a la new?

- is the metaclass passed in to the namespace creation function as a normal keyword argument, or is it automatically removed by the interpreter?

I would hope it's removed.

If the meta keyword is stripped (or only provided when passed in explicitly), then a class method is needed in order to reliably get at the metaclass itself.

Or the keyword is stripped and the metaclass is passed as the first argument, i.e.

prepare(metaclass, name, bases, **kwargs_without_metaclass)

I don't like the idea of requiring the use of classmethod(), since as far as I can tell it's badly broken when it comes to making inherited method calls -- unless there's some technique I don't know about it?

-- Greg



More information about the Python-3000 mailing list