[docs] Update common_issues.rst: update information about reveal type & locals#19059
[docs] Update common_issues.rst: update information about reveal type & locals#19059hauntsaninja merged 10 commits intopython:masterfrom
Conversation
…veal locals Previously it was impossible to have these in at run time (more or less), but now you can just import them.
A5rocks
left a comment
There was a problem hiding this comment.
I tried to find the history of this decision but gave up.
Unsurprising since this was a CPython decision without a PEP or anything :^)
I'm going to guess it was either forgotten or discarded because other type checkers don't implement it. See python/cpython#90572
(this review is just a bunch of nitpicks)
I believe this was on the typing-sig mailing list. I initially proposed adding |
it doesn't in my local testing, but that's ok because it gracefully degrades down to `normal code`
Ah, nevermind: I actually get a hard error when I try to push that: `py:data reference target not found: typing.reveal_type`. This reverts commit a852106.
hauntsaninja
left a comment
There was a problem hiding this comment.
Thanks! I edited to elide some of the detail about reveal_locals.
A goal for the common issues page is that it should be extremely accessible. reveal_locals is already pretty niche, and I'd like to avoid overloading a potential beginner with stuff like if not typing.TYPE_CHECKING: reveal_locals = lambda: None :-)
Previously it was impossible to have these in at run time (more or less), but now you can just import one of them.
Tangential open question I'm curious about: Is there any interest in getting reveal_locals into typing? I've never used it myself, so I have no strong opinions one way or the other, but I'm surprised reveal_type made it in and reveal_locals didn't! I tried to find the history of this decision but gave up.