[issue2121] complex constructor doesn't accept string with nan and inf

Cournapeau David report at bugs.python.org
Wed Dec 31 10:14:02 CET 2008


Cournapeau David <david at ar.media.kyoto-u.ac.jp> added the comment:

I disagree the feature is not needed, for several reasons:
 - complex(repr(..)) roundtrip should work, whatever the value of complex is
 - it is supported for float, so why not for complex ?
 - I believe on the contrary it solves a very real problem: incidently,
I got interested in this patch while working on numpy, and it is
certainly useful to be able to parse nan and inf (for example when we
create arrays from strings). Nan may be seen as non useful for so called
real usage of python, but for scientific people, it is a crucial to have
proper support of nan (which may mean missing data depending on the
context) and inf.
 - it does not add complexity: I would argue that independantly of
nan/inf support, my patch makes the function simpler to follow (no state
machine with done/sw_error/etc... state).

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2121>
_______________________________________


More information about the Python-bugs-list mailing list