On 6/09/21 3:07 am, C. Titus Brown via Python-ideas wrote:
with csv.DictReader.open(filename) as r: for row in r: …
You can do this now: from contextlib import closing with closing(csv.DictReader.open(filename)) as r: ... IMO this is preferable than going around adding context manager methods to everything that has open-like functionality. -- Greg _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/RGCQJZSVMKBU36YK27XGXJI3OUQFBL2L/ Code of Conduct: http://python.org/psf/codeofconduct/