add some To Do items (to David Goodger - don't shoot me because the text now
has embedded URLs - they are temporary. ;-). added [optional keyword args] to the constructor prototypes.
This commit is contained in:
parent
e1e46e817b
commit
bfa7197b40
29
pep-0305.txt
29
pep-0305.txt
|
@ -27,6 +27,19 @@ it possible for programmers to select a CSV module which meets their
|
|||
requirements.
|
||||
|
||||
|
||||
To Do (Notes for the Interested and Ambitious)
|
||||
==============================================
|
||||
|
||||
- Need to better explain the advantages of a purpose-built csv module
|
||||
over the simple ",".join() and [].split() approach.
|
||||
|
||||
- Need to complete initial list of formatting parameters and settle on
|
||||
names.
|
||||
|
||||
- Better motivation for the choice of passing a file object to the
|
||||
constructors. See http://manatee.mojam.com/pipermail/csv/2003-January/000179.html
|
||||
|
||||
|
||||
Existing Modules
|
||||
================
|
||||
|
||||
|
@ -63,13 +76,14 @@ Module Interface
|
|||
The module supports two basic APIs, one for reading and one for
|
||||
writing. The basic reading interface is::
|
||||
|
||||
reader(fileobj [, dialect='excel2000'])
|
||||
reader(fileobj [, dialect='excel2000'] [optional keyword args])
|
||||
|
||||
A reader object is an iterable which takes a file-like object opened
|
||||
for reading as the sole required parameter. The optional dialect
|
||||
parameter is discussed below. It also accepts several keyword
|
||||
parameters which define specific format settings (see the section
|
||||
"Formatting Parameters"). Readers are typically used as follows::
|
||||
parameter is discussed below. It also accepts several optional
|
||||
keyword arguments which define specific format settings for the parser
|
||||
(see the section "Formatting Parameters"). Readers are typically used
|
||||
as follows::
|
||||
|
||||
csvreader = csv.reader(file("some.csv"))
|
||||
for row in csvreader:
|
||||
|
@ -77,11 +91,12 @@ parameters which define specific format settings (see the section
|
|||
|
||||
The writing interface is similar::
|
||||
|
||||
writer(fileobj [, dialect='excel2000'], [, fieldnames=list])
|
||||
writer(fileobj [, dialect='excel2000'], [, fieldnames=list]
|
||||
[optional keyword args])
|
||||
|
||||
A writer object is a wrapper around a file-like object opened for
|
||||
writing. It accepts the same keyword parameters as the reader
|
||||
constructor. In addition, it accepts an optional fieldnames
|
||||
writing. It accepts the same optional keyword parameters as the
|
||||
reader constructor. In addition, it accepts an optional fieldnames
|
||||
argument. This is a list which defines the order of fields in the
|
||||
output file. It allows the write() method to accept mapping objects
|
||||
as well as sequence objects.
|
||||
|
|
Loading…
Reference in New Issue