-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Document that inspect.isclass
returns False for GenericAlias
instances
#132467
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
Comments
I would regard
So according to this, |
GenericAlias
instances
The behaviour here is correct. You can see #89828, and its many linked sub-issues, for the various bugs that can be caused if I'd be open to making an improvement to the docs somewhere if the current docs are confusing, however! |
I also agree that changing anything in |
I think we should improve the docs by saying that GenericAlias instances are not considered to be classes by Note For newcomers, they should update both the online docs (rst) and the docstring. If possible (and if this is not already the case), they could also add a test for that. |
GenericAlias
instancesinspect.isclass
returns False for GenericAlias
instances
@sobolevn Can you assign me to this issue ? I will work on it |
@AbduazizZiyodov sure, please go ahead :) |
Bug report
Bug description:
Hi
I am not sure if this is a bug, but I use the bug template because I couldn't find a better one to submit questions like this one.
The documentation says, "User-defined generic classes can be instantiated.".
In the example above, shouldn't calls such as
inspect.isclass(Node[int])
returnTrue
, since they can be instantiated and used like normal classes?CPython versions tested on:
3.13
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: