This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix punctuation in isinstance() error message
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jack__d, lukasz.langa, miss-islington, pablogsal, wyz23x2
Priority: normal Keywords: patch

Created on 2021-07-14 17:40 by wyz23x2, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 27144 merged wyz23x2, 2021-07-14 17:51
PR 28436 merged miss-islington, 2021-09-17 23:10
Messages (6)
msg397499 - (view) Author: wyz23x2 (wyz23x2) * Date: 2021-07-14 17:40
>>> isinstance(2, 1)
Traceback (most recent call last):
  ...
TypeError: isinstance() arg 2 must be a type, a tuple of types or a union
>>> issubclass(int, 1)
Traceback (most recent call last):
  ..
TypeError: issubclass() arg 2 must be a class, a tuple of classes, or a union.

1) It should be "an union", not "a union".
2) The punctuation marks aren't the same -- there's a comma before "or" in issubclass, but not isinstance(). And issubclass()'s ends with a period, which isn't the same with other builtins' messages.
msg397501 - (view) Author: Jack DeVries (jack__d) * Date: 2021-07-14 18:13
The current string is correct. The word "union" is actually an exception to the "a/an" rule. Here is more detail:

https://english.stackexchange.com/questions/266309/why-is-union-an-exception-to-the-a-an-rule
msg397502 - (view) Author: wyz23x2 (wyz23x2) * Date: 2021-07-14 18:19
Changed to only 2).
msg402110 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-17 23:10
New changeset f4813388b4506b2fafb0089848c5b11cd503758c by wyz23x2 in branch 'main':
bpo-44640: Improve punctuation consistency in isinstance/issubclass error messages (GH-27144)
https://github.com/python/cpython/commit/f4813388b4506b2fafb0089848c5b11cd503758c
msg402163 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-19 19:11
New changeset 9c23a1ebade19f20c7d6e592a7d0329545a9a746 by Miss Islington (bot) in branch '3.10':
bpo-44640: Improve punctuation consistency in isinstance/issubclass error messages (GH-27144) (GH-28436)
https://github.com/python/cpython/commit/9c23a1ebade19f20c7d6e592a7d0329545a9a746
msg403160 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-10-04 19:18
New changeset 39c4fe5e2b2ae5ac45c380b0a83e86bac3d7129c by Pablo Galindo (Miss Islington (bot)) in branch '3.10':
bpo-44640: Improve punctuation consistency in isinstance/issubclass error messages (GH-27144) (GH-28436)
https://github.com/python/cpython/commit/39c4fe5e2b2ae5ac45c380b0a83e86bac3d7129c
History
Date User Action Args
2022-04-11 14:59:47adminsetgithub: 88806
2021-10-04 19:18:42pablogsalsetmessages: + msg403160
2021-09-19 19:31:14pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-09-19 19:11:45pablogsalsetnosy: + pablogsal
messages: + msg402163
2021-09-17 23:10:29miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request26841
2021-09-17 23:10:26lukasz.langasetnosy: + lukasz.langa
messages: + msg402110
2021-07-16 10:52:08wyz23x2settitle: Typos in error messages of isinstance() & issubclass() -> Fix punctuation in isinstance() error message
2021-07-14 18:19:34wyz23x2setmessages: + msg397502
2021-07-14 18:13:25jack__dsetnosy: + jack__d
messages: + msg397501
2021-07-14 17:51:16wyz23x2setkeywords: + patch
stage: patch review
pull_requests: + pull_request25686
2021-07-14 17:40:20wyz23x2create