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
docstring of isinstance #68703
Comments
The docstring of built-in function 'isinstance' should explain that if the classinfo is a tuple, the object must be instance of *any* (not *all*) of the class objects. |
It already does: "The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut If it were "all", it would use "and", not "or". I don't think any change is needed. Do you have a suggestion for new wording? If not, I'm going to close this issue. |
I agree that the tuple explanation if ok. But "Return whether an object is an instance of a class or of a subclass thereof." (3.5) seems wrong. I believe 'subclass' should be 'superclass'.
>>> class C: pass
>>> isinstance(C(), Csub)
False
>>> isinstance(Csub(), C)
True |
On Fri, Jun 26, 2015 at 09:20:18PM +0000, Terry J. Reedy wrote:
No, the current description is correct.
In this case, the instance C() is an instance of a *superclass* of
In this case, the instance Csub() is an instance of a *subclass* of C, |
Right. Close this unless something else is offered. |
Closing. If anyone thinks the docs aren't clear enough, and has an alternate version they would like to suggest, you can re-open it. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: