Skip to content
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

Add __class_getitem__ support to memoryview #126012

Closed
brianschubert opened this issue Oct 26, 2024 · 1 comment
Closed

Add __class_getitem__ support to memoryview #126012

brianschubert opened this issue Oct 26, 2024 · 1 comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-typing type-feature A feature request or enhancement

Comments

@brianschubert
Copy link
Contributor

brianschubert commented Oct 26, 2024

Feature or enhancement

Proposal:

memoryview was made generic in typeshed in python/typeshed#12247. Mypy recently received a report (python/mypy#18053) due to it not being subscriptable at runtime:

>>> memoryview[int]
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    memoryview[int]
    ~~~~~~~~~~^^^^^
TypeError: type 'memoryview' is not subscriptable

It seems that memoryview should be made subscriptable at runtime, like other standard library classes that are generic in typeshed.

Happy to make a PR if there's agreement that this should be added.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@brianschubert brianschubert added the type-feature A feature request or enhancement label Oct 26, 2024
@picnixz picnixz added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Oct 26, 2024
sobolevn pushed a commit that referenced this issue Oct 27, 2024
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Peter Bierma <[email protected]>
@picnixz
Copy link
Contributor

picnixz commented Oct 27, 2024

Closing since completed. Thanks for the contribution.

@picnixz picnixz closed this as completed Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-typing type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants