Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-46480: rephrase typing.assert_type docs #32069

Merged
merged 1 commit into from Mar 24, 2022

Conversation

hauntsaninja
Copy link
Contributor

@hauntsaninja hauntsaninja commented Mar 23, 2022

The goal here is to reduce potential confusion between
assert_type(val, typ) and assert isinstance(val, typ).

The former is meant to ask a type checker to confirm a fact, the latter
is meant to tell a type checker a fact. The behaviour of the latter more
closely resembles what I'd expect from the previous phrasing of
"assert [something] to the type checker".

https://bugs.python.org/issue46480

The goal here is to reduce potential confusion between
`assert_type(val, type)` and `assert isinstance(val, typ)`.

The former is meant to ask a type checker to confirm a fact, the latter
is meant to tell a type checker a fact. The behaviour of the latter more
closely resembles what I'd expect from the prior phrasing of
"assert [something] to the type checker".
@hauntsaninja
Copy link
Contributor Author

(We can skip-news, since this is just docs for a new feature. This was originally brought up at python/typing#1103 )

@JelleZijlstra JelleZijlstra merged commit 3354245 into python:main Mar 24, 2022
@hauntsaninja hauntsaninja deleted the typeassert branch March 24, 2022 02:30
hauntsaninja added a commit to hauntsaninja/cpython that referenced this pull request Apr 29, 2022
This change is similar to that in python#32069
JelleZijlstra pushed a commit that referenced this pull request Apr 30, 2022
This change is similar to that in #32069
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants