You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
deffinal(f):
try:
f.__final__=TrueexceptAttributeError:
pass# in case it is used on an object that doesn't support setting attributesreturnf
Activity
JelleZijlstra commentedon Jan 11, 2022
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:
I will submit a PR implementing this idea.
gvanrossum commentedon Jan 12, 2022
New changeset 0bbf30e by Jelle Zijlstra in branch 'main':
bpo-46342: make @typing.final introspectable (GH-30530)
0bbf30e