You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The term "typechecks" is confusingly used as an adjective #96130
Arguably to new eyes, you can mistaken "typecheck" to be a verb meaning "to do type checking". I understand this term came from the C function TypeCheck that returns a boolean.
The static type checker will treat the new type as if it were a subclass of the original type. This is useful in helping catch logical errors:
defget_user_name(user_id: UserId) ->str:
...
# typechecksuser_a=get_user_name(UserId(42351))
# does not typecheck; an int is not a UserIduser_b=get_user_name(-1)
The last two line may mean, the type checker skips checking this line.
Activity
ketozhang commentedon Aug 19, 2022
It's particular confusing in NewType https://docs.python.org/3.10/library/typing.html#newtype
The static type checker will treat the new type as if it were a subclass of the original type. This is useful in helping catch logical errors:
The last two line may mean, the type checker skips checking this line.
ericvsmith commentedon Aug 19, 2022
Do you have a proposal to improve this? I think it’s okay as-is, but if you can make it better that would be good.
ketozhang commentedon Aug 22, 2022
I believe "Passes type checking" and "Fails type checking" is very clear.
ericvsmith commentedon Aug 22, 2022
Agreed!
pythongh-96130: Rephrase use of "typecheck" verb for clarity
gh-96130: Rephrase use of "typecheck" verb for clarity (#98144)
pythongh-96130: Rephrase use of "typecheck" verb for clarity (pythonG…
pythongh-96130: Rephrase use of "typecheck" verb for clarity (pythonG…
JelleZijlstra commentedon Oct 12, 2022
Thanks @ketozhang for the report and @hauntsaninja for the fix!
gh-96130: Rephrase use of "typecheck" verb for clarity (GH-98144)
gh-96130: Rephrase use of "typecheck" verb for clarity (GH-98144)
Merge branch 'main' into typewatch
Merge branch 'main' into cached_property
gh-96130: Rephrase use of "typecheck" verb for clarity (GH-98144)