Re:What's New in Python 3.11?
by bostik on Monday June 27, 2022 @12:13PM
(#31896670)
If by extending you mean that you want to have a type that includes ALL the functionality of another type, without needing to fill in each method, that's already supported.
In your new struct definition, include the desired base type as a member - without giving it a name. That embeds the unnamed member directly, and your new type automatically gets all the interfaces and their underlying implementations. As a python-person I always found this a somewhat odd mechanism, but from a functionality perspective it satisfies what I have wanted to do.
In your new struct definition, include the desired base type as a member - without giving it a name. That embeds the unnamed member directly, and your new type automatically gets all the interfaces and their underlying implementations. As a python-person I always found this a somewhat odd mechanism, but from a functionality perspective it satisfies what I have wanted to do.
Guess that's what people mean by composability.