In #Python >= 3.8, this code raises "TypeError: Cannot inherit from plain Generic":
but this one works:
@val that's surprising, is it checking the name?
@val that's surprising but I can understand why
@ashwinvis @bram Yeah, Protocols are cool. Basically it's like a Rust trait or a C++ interface; a class is said to implement a Protocol if it implements all the methods in it (it doesn't even need to inherit it to be considered a subclass).
For example, Iterable is a Protocol, which requires classes to implement a __iter__ method.
oc.todon.fr is a mostly French-speaking Mastodon instance with an active moderation. oc.todon.fr est une instance Mastodon principalement francophone et avec une modération active.