-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
The term "typechecks" is confusingly used as an adjective #96130
Comments
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: def get_user_name(user_id: UserId) -> str:
...
# typechecks
user_a = get_user_name(UserId(42351))
# does not typecheck; an int is not a UserId
user_b = get_user_name(-1) The last two line may mean, the type checker skips checking this line. |
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. |
I believe "Passes type checking" and "Fails type checking" is very clear. |
Agreed! |
I'm sympathetic to the issue report, especially in case this helps clarify to new users that Python itself does not do type checking at runtime
I'm sympathetic to the issue report, especially in case this helps clarify to new users that Python itself does not do type checking at runtime
Thanks @ketozhang for the report and @hauntsaninja for the fix! |
I'm sympathetic to the issue report, especially in case this helps clarify to new users that Python itself does not do type checking at runtime (cherry picked from commit ed6344e) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
I'm sympathetic to the issue report, especially in case this helps clarify to new users that Python itself does not do type checking at runtime (cherry picked from commit ed6344e) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* main: (38 commits) pythongh-98251: Allow venv to pass along PYTHON* variables to pip and ensurepip when they do not impact path resolution (pythonGH-98259) Bpo-41246: IOCP Proactor avoid callback code duplication (python#21399) bpo-46364: Use sockets for stdin of asyncio only on AIX (python#30596) pythongh-98178: syslog() is not thread-safe on macOS (python#98213) Mark all targets in `Doc/Makefile` as `PHONY` (pythonGH-98189) pythongh-97982: Factorize PyUnicode_Count() and unicode_count() code (python#98025) pythongh-96265: Formatting changes for faq/general (python#98129) tutorial: remove "with single quotes" (python#98204) pythongh-97669: Remove Tools/scripts/startuptime.py (python#98214) signalmodule.c uses _PyErr_WriteUnraisableMsg() (python#98217) pythongh-97669: Fix test_tools reference leak (python#98216) pythongh-97669: Create Tools/patchcheck/ directory (python#98186) pythongh-65046: Link to logging cookbook from asyncio docs (python#98207) Formatting fixes in contextlib docs (python#98111) pythongh-95276: Add callable entry to the glossary (python#95738) pythongh-96130: Rephrase use of "typecheck" verb for clarity (python#98144) Fix some incorrect indentation around the main switch (python#98177) pythongh-98172: Fix formatting in `except*` docs (python#98173) pythongh-97982: Remove asciilib_count() (python#98164) pythongh-95756: Free and NULL-out code caches when needed (pythonGH-98181) ...
* main: (37 commits) pythongh-98251: Allow venv to pass along PYTHON* variables to pip and ensurepip when they do not impact path resolution (pythonGH-98259) Bpo-41246: IOCP Proactor avoid callback code duplication (python#21399) bpo-46364: Use sockets for stdin of asyncio only on AIX (python#30596) pythongh-98178: syslog() is not thread-safe on macOS (python#98213) Mark all targets in `Doc/Makefile` as `PHONY` (pythonGH-98189) pythongh-97982: Factorize PyUnicode_Count() and unicode_count() code (python#98025) pythongh-96265: Formatting changes for faq/general (python#98129) tutorial: remove "with single quotes" (python#98204) pythongh-97669: Remove Tools/scripts/startuptime.py (python#98214) signalmodule.c uses _PyErr_WriteUnraisableMsg() (python#98217) pythongh-97669: Fix test_tools reference leak (python#98216) pythongh-97669: Create Tools/patchcheck/ directory (python#98186) pythongh-65046: Link to logging cookbook from asyncio docs (python#98207) Formatting fixes in contextlib docs (python#98111) pythongh-95276: Add callable entry to the glossary (python#95738) pythongh-96130: Rephrase use of "typecheck" verb for clarity (python#98144) Fix some incorrect indentation around the main switch (python#98177) pythongh-98172: Fix formatting in `except*` docs (python#98173) pythongh-97982: Remove asciilib_count() (python#98164) pythongh-95756: Free and NULL-out code caches when needed (pythonGH-98181) ...
I'm sympathetic to the issue report, especially in case this helps clarify to new users that Python itself does not do type checking at runtime (cherry picked from commit ed6344e) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Documentation
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 text was updated successfully, but these errors were encountered: