Data model and attribute resolution in subclasses
Lele Gaifax
lele at metapensiero.it
Mon Mar 2 05:25:25 EST 2020
Adam Preble <adam.preble at gmail.com> writes:
> On Sunday, March 1, 2020 at 3:08:29 PM UTC-6, Terry Reedy wrote:
>
>> Because BaseClass is the superclass of SubClass.
>
> So there's a mechanism for parent classes to know all their children?
Yes, you just used it, although you may have confused its meaning:
>>> class Base:
... pass
...
>>> class Derived(Base):
... pass
...
>>> print(Base.__subclasses__())
[<class '__main__.Derived'>]
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it | -- Fortunato Depero, 1929.
More information about the Python-list
mailing list