Traling junk in string.atof (RE: array constructor)

Tom Holroyd tomh at po.crl.go.jp
Mon Feb 28 11:37:30 CET 2000


On Sun, 27 Feb 2000, Tim Peters wrote:

> I'm curious how you ended up with a numeric string with a trailing comma to
> begin with.  For example, if you're reading lines of comma-separated values,
> the natural idiom is
> 
>     numbers = map(float, string.split(line, ","))

Eh, parsing a random file that was meant more for humans; I had already
done a split on some other separator and was loathe to perform two (or is
that "slothe"? :-)

I just thought it would make sense for a function _called_ atof() to
_behave_like_ the POSIX function atof(), which converts the initial
portion of a string only -- a behavior which most programmers that use
atof() are well aware of (and even (gosh) use).

Dr. Tom




More information about the Python-list mailing list