According to http://www.python.org/dev/peps/pep-3115/ the way to specify a metaclass other than type is to use the keyword-only argument metaclass in the class statement:
class Foo(base1, base2, metaclass=mymeta):
...
the metaclass is called with name, bases and dict plus any additional keyword argument in the class statement to effectively create the class object.
The metaclass can also define the "dict" used for class attributes if it has a prepare method with is called as follows:
def prepare_class(name, *bases, metaclass=None, **kwargs):
if metaclass is None:
metaclass = compute_default_metaclass(bases)
prepare = getattr(metaclass, '__prepare__', None)
if prepare is not None:
return prepare(name, bases, **kwargs)
else:
return dict()
The modifications seems not very difficult, but the major problem seems to be an incompatibility with our class desugar strategy since the class body integrity is lost in the process.
According to http://www.python.org/dev/peps/pep-3115/ the way to specify a metaclass other than type is to use the keyword-only argument metaclass in the class statement:
the metaclass is called with name, bases and dict plus any additional keyword argument in the class statement to effectively create the class object.
The metaclass can also define the "dict" used for class attributes if it has a prepare method with is called as follows:
The modifications seems not very difficult, but the major problem seems to be an incompatibility with our class desugar strategy since the class body integrity is lost in the process.
Update: the class body integrity issue was solved in https://github.com/brownplt/lambda-py/commit/8d002574ee23984b98439cf4374e2044b4c5eec5