Hacker News new | ask | show | jobs
by nerdponx 1113 days ago
Yes, that's what @typing.final is: 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!")