Closed kfreezen closed 1 month ago
That could potentially work if OtherMeta
can be extended without breaking all of the assumptions TraceMeta
already has about class objects. Given the complexity of metaclasses, I expect that won't be the case. But additionally the next part of the book says "But this won’t work if ... I want to use multiple utility metaclasses like TraceMeta at the same time". So if you have many metaclasses from many libraries you can't modify, there's no way to compose them together. Does that make sense?
I find the text "This fails because TraceMeta does not inherit from OtherMeta. In theory, I can use metaclass inheritance to solve this problem by having OtherMeta inherit from TraceMeta:" confusing.
If
OtherMeta
andSimpleDict
are a third-party library, why couldn't TraceMeta just subclass OtherMeta? Wouldn't that take care of your meta class issue? Or is there some blindingly obvious issue I am overlooking?