python init_subclass code example
Example: python __init_subclass__
In [16]: class Foo:
...: def __init_subclass__(cls):
...: print('ok')
...: print(cls.att)
In [17]: class SubFoo(Foo):
...: att = 1
...: pass
...:
ok
1
# So: __init_subclass__ runs everytime that Foo is subclassed.
# Also: the argument `cls` of __init_subclass__ is the subclass.