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: isinstance error message
Type: Stage:
Components: Interpreter Core Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: loewis, nnorwitz, theller
Priority: normal Keywords: patch

Created on 2002-05-24 17:51 by theller, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
abstract.diff theller, 2002-05-24 17:51 Patch for abstract.diff
abstract.diff theller, 2002-05-27 14:31 Patch for abstract.c, with comma
Messages (8)
msg40112 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-05-24 17:51
isinstance now accepts a tuple containing classes 
and/or types as second argument.
The patch abstract.diff implements a better error 
message:

isinstance arg 2 must be a class, type or tuple of 
classes and types

instead of

isinstance arg 2 must be a class or type
msg40113 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-05-24 18:18
Logged In: YES 
user_id=33168

We should update the docstring too.
msg40114 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-05-24 18:20
Logged In: YES 
user_id=11105

The doc-string seems ok. Here is it from 2.2.1:

isinstance(object, class-or-type-or-tuple) -> Boolean

Return whether an object is an instance of a class or of a 
subclass thereof.
With a type as second argument, return whether that is the 
object's type.
The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut 
for
isinstance(x, A) or isinstance(x, B) or ... (etc.).
msg40115 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-05-24 18:28
Logged In: YES 
user_id=33168

Sorry about that, 2.1.x was the last version where the
docstring didn't have tuple.

Patch looks good to me.
msg40116 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-05-27 13:33
Logged In: YES 
user_id=21627

Isn't there a komma missing between "type" and "or"?
msg40117 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-05-27 14:31
Logged In: YES 
user_id=11105

Right.
msg40118 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-05-27 14:33
Logged In: YES 
user_id=11105

I've attached a new patch.
msg40119 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-06-05 12:56
Logged In: YES 
user_id=11105

Checked in as revision 2.102.
History
Date User Action Args
2022-04-10 16:05:21adminsetgithub: 36644
2002-05-24 17:51:58thellercreate