diff options
| author | Georg Brandl <georg@python.org> | 2008-03-21 20:01:51 (GMT) | 
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2008-03-21 20:01:51 (GMT) | 
| commit | 77354cf5ef9644121a28041216591762628d8b65 (patch) | |
| tree | b0fc669e46257a85f58988cd93180cfe5cc71ef8 /Lib/csv.py | |
| parent | 331243270dc91cfccd31b071abb8d2fcf84a7984 (diff) | |
| download | cpython-77354cf5ef9644121a28041216591762628d8b65.zip cpython-77354cf5ef9644121a28041216591762628d8b65.tar.gz cpython-77354cf5ef9644121a28041216591762628d8b65.tar.bz2  | |
Issue #2432: give DictReader the dialect and line_num attributes
advertised in the docs.
Diffstat (limited to 'Lib/csv.py')
| -rw-r--r-- | Lib/csv.py | 3 | 
1 files changed, 3 insertions, 0 deletions
@@ -75,6 +75,8 @@ class DictReader:          self.restkey = restkey          # key to catch long rows          self.restval = restval          # default value for short rows          self.reader = reader(f, dialect, *args, **kwds) +        self.dialect = dialect +        self.line_num = 0      def __iter__(self):          return self @@ -84,6 +86,7 @@ class DictReader:          if self.fieldnames is None:              self.fieldnames = row              row = self.reader.next() +        self.line_num = self.reader.line_num          # unlike the basic reader, we prefer not to return blanks,          # because we will typically wind up with a dict full of None  | 
