Message216780
Regarding the `skipinitialspace` parameter to the different CSV reader dialects in the `csv` module, the official documentation asserts:
When True, whitespace immediately following the delimiter is ignored.
and the `help(csv)` style module documentation says:
* skipinitialspace - specifies how to interpret whitespace which
immediately follows a delimiter. It defaults to False, which
means that whitespace immediately following a delimiter is part
of the following field.
"Whitespace" is a bit too general in both cases (at least a red herring in the second case), since it only skips spaces and not e.g. tabs [1].
In `Modules/_csv.c`, it more correctly describes the parameter. At line 81:
int skipinitialspace; /* ignore spaces following delimiter? */
and the actual implementation at line 638:
else if (c == ' ' && dialect->skipinitialspace)
/* ignore space at start of field */
;
No-one will probably assume that the whole UTF-8 spectrum of "whitespace" is skipped, but at least I initially assumed that the tab character was included.
[1]: http://en.wikipedia.org/wiki/Whitespace_character |
|
Date |
User |
Action |
Args |
2014-04-18 11:52:21 | Daniel.Andersson | set | recipients:
+ Daniel.Andersson, docs@python |
2014-04-18 11:52:21 | Daniel.Andersson | set | messageid: <1397821941.61.0.706896478348.issue21297@psf.upfronthosting.co.za> |
2014-04-18 11:52:21 | Daniel.Andersson | link | issue21297 messages |
2014-04-18 11:52:20 | Daniel.Andersson | create | |
|