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

Method __init_subclass__

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

Source from the content-addressed store, hash-verified

237 color = None # Must be specified by subclasses
238
239 def __init_subclass__(cls):
240 super().__init_subclass__()
241 if cls.color not in ("red", "green", "blue"):
242 raise ValueError("Fills need a valid color")
243
244
245print("Example 13")

Callers

nothing calls this directly

Calls 1

__init_subclass__Method · 0.45

Tested by

no test coverage detected