Message191604
What is the purpose in touching fieldnames, either in tuple-izing it or in making it private and wrapped with a property. If someone wants to modify it, that is up to them. In any case, this change is not germane to the issue and could break code, so I would not make it.
wrong_fields could be calculated with
any(k for k in rowdict if k not in self._fieldset)
to stop on the first extra, if any.
That said, in 3.x, replacing
wrong_fields = <long expression>
if wrong_fields:
with
if rowdict.keys() - self._fieldset:
should be even faster because the iteration, which will nearly always go to completion, is entirely in C (or whatever).
Does test/text_cvs have tests for DictWriter, both with and without rowdict errors? If so, or if added, I would be willing to commit a patch that simply added ._fieldset and used it as above for a set difference.
Also, if you have not done so yet, please go to
http://www.python.org/psf/contrib/ and
http://www.python.org/psf/contrib/contrib-form/ new electronic form
and submit a contributor agreement. An '*' will appear after your name here when it is processed. |
|
Date |
User |
Action |
Args |
2013-06-21 19:05:40 | terry.reedy | set | recipients:
+ terry.reedy, serhiy.storchaka, mtraskin |
2013-06-21 19:05:40 | terry.reedy | set | messageid: <1371841540.31.0.50246057942.issue18219@psf.upfronthosting.co.za> |
2013-06-21 19:05:40 | terry.reedy | link | issue18219 messages |
2013-06-21 19:05:40 | terry.reedy | create | |
|