-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
csv.DictReader
and DictWriter
not subscriptable at runtime
#92391
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
Why are they generic in typeshed? |
The classes are slightly complicated to type, so I am not sure the stubs are 100% correct at the moment (I have a PR open at the moment to improve them). But I think it is correct that they are both generic. Copying what I wrote in python/typeshed#7787 (comment):
|
I am not sure that they were designed this way. Why not return just |
Can you give an example? If the stubs are incorrect, I would be interested in improving them. |
The type of keys: the type of any item in |
Feature or enhancement
Add PEP 585 style
__class_getitem__
tocsv.DictReader
andcsv.DictWriter
.Pitch
With PEP 585 most generic stdlib types are now subscriptable at runtime. Both DictReader and DictWriter are generic in typeshed but don't yet implement
__class_getitem__
.Previous discussion
The text was updated successfully, but these errors were encountered: