Feature or enhancement
Add PEP 585 style __class_getitem__ to csv.DictReader and csv.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__.
from csv import DictWriter
from typing import IO
def f(fp: IO[str]) -> DictWriter[str]:
return DictWriter(fp, ["id", "name"])
Previous discussion
Feature or enhancement
Add PEP 585 style
__class_getitem__tocsv.DictReaderandcsv.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