Open almazkun opened 4 years ago
Thanks for the report! You're right. This should be BetterPolygon
in all of the references to Polygon
that follow the Filled
class definition. The resulting behavior and output doesn't change with that fix, since the Polygon
metaclass implemented the same behavior. But this is an important detail.
Keeping this open for tracking purposes.
Good day! Thank you you for your book. It is incredibly interesting and well written book.
There is a little confusion toward the end of the item 48. Where you describe how two validations classes with
super().__init_subclass__
can be inherited by one class.Yon stated in the paragraph that it will be inherited from
BetterPolygon
class defined earlier, but in the code examplePolygon
class is used, witch is an example of metaclass usage.Here is the exact part from the book:
It’s even compatible with multiple inheritance. Here, I define a class to represent region fill color that can be composed with the
BetterPolygon
class from before:I can inherit from both classes to define a new class. Both classes call super().__init_subclass__(), causing their corresponding validation logic to run when the subclass is created:
Thank you!