This question is related to this question about PyTables metaclasses. I was trying to subclass the IsDescription
metaclass in PyTables, to define the shape of the Column by a variable:
import tables
class MyClass(tables.IsDescription):
def __init__(self, param):
var1 = tables.Float64Col(shape=(param))
MyClass1 = MyClass(12)
This throws the error: TypeError: object.__new__()
takes no parameters. Using self.var1 = ...
gives the same error.
In this SO question the same error is reported, and the reason is attributed to the fact that IsDescription
is a metaclass.
My question (which is not answered at the linked question, and I haven't been able to find anything by Googling) is: why do metaclasses prohibit this functionality? Is it specific to this metaclass, or generic for all metaclasses?