__metaclass__ in Python 3
__metaclass__ in Python 3 Question: In Python2.7 this code can work very well, __getattr__ in MetaTable will run. But in Python 3 it doesn’t work. class MetaTable(type): def __getattr__(cls, key): temp = key.split(“__”) name = temp[0] alias = None if len(temp) > 1: alias = temp[1] return cls(name, alias) class Table(object): __metaclass__ = MetaTable def …