[New-bugs-announce] [issue33158] Add fileobj property to csv reader and writer objects

Samwyse report at bugs.python.org
Tue Mar 27 12:17:09 EDT 2018


New submission from Samwyse <samwyse at gmail.com>:

Many objects have properties that allow access to the arguments used to create them.  In particular, file objects have a name property that returns the name used when opening a file.  A fileobj property would be convenient, as you otherwise, for example, need to pass an extra argument to routines that need both the csv object and the underlying file object.  Adopting this enhancement would also provide consistency with the dialect constructer argument, which is available as an object property.

Changing the fileobj while the csv object is in use would open a can of worms, so this should be a read-only property.

Optionally, the fileobj property could be reflected in the DictReader and DictWriter classes, but the value would be accessible via the .reader and .writer properties of those classes.

----------
components: Library (Lib)
messages: 314538
nosy: samwyse
priority: normal
severity: normal
status: open
title: Add fileobj property to csv reader and writer objects
type: enhancement
versions: Python 2.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33158>
_______________________________________


More information about the New-bugs-announce mailing list