MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / __init_subclass__

Method __init_subclass__

example_code/item_062.py:125–128  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

123 sides = None # Must be specified by subclasses
124
125 def __init_subclass__(cls):
126 super().__init_subclass__()
127 if cls.sides < 3:
128 raise ValueError("Polygons need 3+ sides")
129
130 @classmethod
131 def interior_angles(cls):

Callers

nothing calls this directly

Calls 1

__init_subclass__Method · 0.45

Tested by

no test coverage detected