2 ms·
Yes, that's what @typing.final is: https://docs.python.org/3/library/typing.html#typing.final https://docs.python.org/3/library/typing.html#typing.final But th
by nerdponx 3y ago
Yes, that's what @typing.final is: https://docs.python.org/3/library/typing.html#typing.final https://docs.python.org/3/library/typing.html#typing.final
But that's only checked by the type checker. At runtime you still need to do something like this to prevent subclassing:
class DontSubclassMe:
def __init_subclass__(self):
raise TypeError("Don't subclass me!")