[Csv] CSV interface question

Andrew McNamara andrewm at object-craft.com.au
Thu Jan 30 00:45:26 CET 2003


>With the class technique this would become:
>
>def reader(fileobj, dialect=excel, **kwds):
>    kwargs = {}
>    for key, value in dialect.__dict__.iteritems():
>        if not key.startswith('_'):
>            kwargs[key] = value
>    kwargs.update(kwds)
>    return _csv.reader(fileobj, **kwargs)

BTW, your method of extracting directly from the instance's __dict__
doesn't pick up class attributes. In my prototype implementation, I used
getattr instead.

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
_______________________________________________
Csv mailing list
Csv at mail.mojam.com
http://manatee.mojam.com/mailman/listinfo/csv



More information about the Csv mailing list