This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JelleZijlstra
Recipients JelleZijlstra, gvanrossum, kj
Date 2022-01-11.12:10:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641903025.56.0.417443155132.issue46342@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2022-01-11 12:10:26JelleZijlstrasetrecipients: + JelleZijlstra, gvanrossum, kj
2022-01-11 12:10:25JelleZijlstrasetmessageid: <1641903025.56.0.417443155132.issue46342@roundup.psfhosted.org>
2022-01-11 12:10:25JelleZijlstralinkissue46342 messages
2022-01-11 12:10:25JelleZijlstracreate