1class Philosopher:
2 def __init_subclass__(cls, default_name, **kwargs):
3 super().__init_subclass__(**kwargs)
4 print(f"Called __init_subclass({cls}, {default_name})")
5 cls.default_name = default_name
6
7class AustralianPhilosopher(Philosopher, default_name="Bruce"):
8 pass
9
10class GermanPhilosopher(Philosopher, default_name="Nietzsche"):
11 default_name = "Hegel"
12 print("Set name to Hegel")
13
14Bruce = AustralianPhilosopher()
15Mistery = GermanPhilosopher()
16print(Bruce.default_name)
17print(Mistery.default_name)
18