Closed
Description
In some languages (e.g. java) it's possible to declare a class as final so that it can't be subclassed; similarly, it's possible to declare functions as final
so that they can't be overridden by sublclasses. It would be great if typing could support this - so that classes could be annotated as final or their functions as final, and then tools like mypy could enforce it.
E.g.
@final
class Foo(object):
pass
# type error
class Bar(Foo):
pass
(reposting from python/mypy#2032)
Metadata
Metadata
Assignees
Labels
No labels