New submission from Jelle Zijlstra <[email protected]>:
Currently, @typing.final is implemented as an identity function, which makes it
impossible for type checkers that look at runtime objects to support it.
I propose that we implement it as something like:
def final(f):
try:
f.__final__ = True
except AttributeError:
pass # in case it is used on an object that doesn't support
setting attributes
return f
I will submit a PR implementing this idea.
----------
assignee: Jelle Zijlstra
components: Library (Lib)
messages: 410298
nosy: Jelle Zijlstra, gvanrossum, kj
priority: normal
severity: normal
stage: needs patch
status: open
title: Make @final introspectable at runtime
type: enhancement
versions: Python 3.11
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46342>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com