GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||
GeezerVison is showing github.com — Add tests for `Final`/`Literal` interaction by srittau · Pull Request #2352 · python/typing Conversation
|
It means that if the automated conformance fails, it is your responsibility to analyze the nature of the gap for that type checker, and decide whether |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Specification: https://typing.readthedocs.io/en/latest/spec/qualifiers.html#id1 | ||
|
|
||
| ID1: Final[int] = 1 | ||
| assert_type(ID1, Literal[int]) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Literal[int] is not a valid type expression (and thus every type checker correctly errors on it). Same with Literal[float] below.
Did you mean to assert the type is just int? If so, I don't think that's an assertion supported by the spec. https://typing.python.org/en/latest/spec/literal.html#interactions-with-final explicitly says that in this exact scenario, an inference of either int or Literal[1] is fine.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Interesting, another contradiction in the spec.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
What is your intention for this PR vs #2353 ? I think it would be simpler and preferable to just have one combined PR that modifies both the spec text and the conformance suite, rather than two separate PRs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sure, I can combine them if you prefer. Considering that both are more or less independent (since the are only refactorings/documentation of the status quo) I thought it would be easier to review separately. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don't have strong feelings; if you prefer to separate them, that's fine. I would personally find it easier to review them together; it makes it easier to validate that we have the right tests for the clarified spec text. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Will merge when I get home. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.