MCPcopy Index your code
hub / github.com/bslatkin/effectivepython / __init_subclass__

Method __init_subclass__

example_code/item_065.py:222–227  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

220print("Example 13")
221class DescriptorRowMapper(RowMapper):
222 def __init_subclass__(cls):
223 fields = []
224 for key, value in cls.__dict__.items():
225 if isinstance(value, Field): # Changed
226 fields.append(key)
227 cls.fields = tuple(fields)
228
229try:
230 DescriptorRowMapper.from_row([1, 2, 3, 4])

Callers

nothing calls this directly

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected