FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-46480: rephrase typing.assert_type docs by hauntsaninja · Pull Request #32069 · python/cpython · GitHub

/ cpython Public

bpo-46480: rephrase typing.assert_type docs - #32069

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
hauntsaninja:typeassert
Mar 24, 2022
Merged

bpo-46480: rephrase typing.assert_type docs#32069
JelleZijlstra merged 1 commit into
python:mainfrom
hauntsaninja:typeassert

Conversation

hauntsaninja commented Mar 23, 2022
edited
Loading

Copy link
Copy Markdown
Contributor

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".

Copy link
Copy Markdown
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 merged commit 3354245 into python:main Mar 24, 2022
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

5 participants


Back | FazBrowse Home | New Git URL