-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed as not planned
Closed as not planned
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
We have singletons like sys.monitoring.MISSING and sys.monitoring.DISABLE - and there's no way to annotate them in the function. In our own documentation we have something like
func(code: CodeType, instruction_offset: int) -> DISABLE | Anybut that's just wrong (well maybe pseudo?) - we can't do that. It's common to annotate a callback function with sys.monitoring.DISABLE, if you don't want to use Any. If you want to use it somewhere else, you might want to annotate as well.
I'm not the typing expert, but is there a way to support this? Literal[sys.monitoring.DISABLE] won't work either because it's a variable - I would accept that.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-featureA feature request or enhancementA feature request or enhancement