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?
@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.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!