Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

Possible small csv.DictReader change

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


skip at pobox

Jul 26, 2008, 8:21 PM

Post #1 of 1 (301 views)
Permalink
Possible small csv.DictReader change

A new issue in the tracker:

http://bugs.python.org/issue3436

points out that the csv module's DictReader class doesn't know the
fieldnames defined in the file until you've fetched the first row of data.
It's fairly easy to change the behavior so that __init__ automatically grabs
the fieldnames if they aren't passed into it (I attached a patch) but
Raymond commented that __init__() shouldn't read any line(s) from the file,
instead preferring a separate method to set the fieldnames attribute.

There's the issue though of whether __init__() should implicitly read the
fieldnames from the file or if that task should be delegated to a separate
method which must be called either by the user or from the next() method.
If you have an opinion either way, I'd appreciate it if you added a comment
to that issue.

Regardless which way this issue plays out, is it something that can be put
into 2.6 & 3.0 or does it need to wait at this point?

Thanks,

Skip
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.