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

2009-01-20 Thread Mark Dickinson
Mark Dickinson added the comment: Closing this one as won't fix. -- resolution: -> wont fix status: open -> closed ___ Python tracker ___ ___

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

2009-01-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Mark, I'm somewhat uncomfortable with your proposal also. It changes what the parser will accept and the potential benefits are almost nil. Also, putting NaNs and Infs in complex numbers is probably not something that should be pursued. I see no utility in

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

2009-01-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: David, at this point, I recommend dropping this one. It has become a time waster. Possibly, there is a refactoring of the code that makes parsing a bit simpler or shares some common code but it is not worth destabilizing the battle-tested code and risking t

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

2009-01-06 Thread Cournapeau David
Cournapeau David added the comment: @ Mark Concerning float('inf') * 1j: you're right, my rambling did not make any sense, sorry. I agree that adding complexity may be a good reason to warrant an arbitrary feature; actually, I did not manage to handle nan/inf at first because of the complexity

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

2009-01-06 Thread Mark Dickinson
Mark Dickinson added the comment: As Christian says, it's about not increasing code complexity without a good reason. For me, it's also about mental complexity: the set of valid inputs to the complex constructor should be small, and should be easy to understand and to describe. The additio

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

2009-01-06 Thread Cournapeau David
Cournapeau David added the comment: > I disagree. *Why* do you think it should work? It fails for many other > types: I don't understand the rationale: why not making something work better if possible ? Also, I don't understand the comparison with Decimal or Fraction; there is a big differenc

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

2009-01-06 Thread Mark Dickinson
Mark Dickinson added the comment: Christian, any comments? Is it okay to close this as a 'won't fix'? ___ Python tracker ___ ___ Python-bugs-l

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

2009-01-06 Thread Mark Dickinson
Mark Dickinson added the comment: [Mark] > inputs with a special real or imaginary component. On balance, I'd > support making complex('nan + nan*j') do the right thing. Having thought about this a bit more, I take this back. Some reasons are given below. [David] > - complex(repr(..)) roun

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

2009-01-02 Thread Cournapeau David
Cournapeau David added the comment: It is not really for an application, but for numpy. Of course, one can always get around the problem - but since this is really a limitation which can be easily fixed, why not fixing the problem :) ? ___ Python tracker

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

2009-01-02 Thread Mark Dickinson
Mark Dickinson added the comment: cdavid, in your application, how hard is it to work around the problem by simply printing and parsing pairs of floats rather than complex numbers? E.g., z = complex(float(real_part), float(imag_part)) ___ Python tracker

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

2009-01-02 Thread Mark Dickinson
Mark Dickinson added the comment: [Raymond] > I would > not like to see that extended to cmath or complex() unless compelling > real-world use cases arise. Hmm. Have you looked at the cmath module recently? You may be in for a nasty surprise... > Mark, does Inf have a standard interpretatio

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

2008-12-31 Thread Cournapeau David
Changes by Cournapeau David : Removed file: http://bugs.python.org/file12502/nan_parse.patch ___ Python tracker ___ ___ Python-bugs-list mailin

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

2008-12-31 Thread Cournapeau David
Changes by Cournapeau David : Removed file: http://bugs.python.org/file12503/nan_parse.patch ___ Python tracker ___ ___ Python-bugs-list mailin

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

2008-12-31 Thread Cournapeau David
Cournapeau David added the comment: Ok, I found out how to make tests, and I found some problems while using this on numpy. A third version of the patch, with unit tests: all tests in test_complex.py pass. Added file: http://bugs.python.org/file12504/nan_parse.patch ___

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

2008-12-31 Thread Cournapeau David
Cournapeau David added the comment: > Nice-to-have but not a requirement that the entire input domain be > supported. Ok. > It made sense for floats because of prevalence of use cases and > because we wanted to match IEEE-754R as much as possible. But why shouldn't this apply to complex numb

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

2008-12-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: > complex(repr(..)) roundtrip should work, Nice-to-have but not a requirement that the entire input domain be supported. > it is supported for float, so why not for complex ? It made sense for floats because of prevalence of use cases and because we wante

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

2008-12-31 Thread Cournapeau David
Cournapeau David 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: incidentl

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

2008-12-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: -1 on this feature request. IMO, it adds no value to any real world applications and isn't worth the added code complexity, the on-going maintenance burden, and the risk of introducing new bugs. -- nosy: +rhettinger type: -> feature request __

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

2008-12-30 Thread Cournapeau David
Cournapeau David added the comment: Of course, I notice two bugs just after sending the patch... New patch to fix those two issues (no check for closing bracket if opening ones are there and a bug when only imaginary part is given). Added file: http://bugs.python.org/file12503/nan_parse.patch

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

2008-12-30 Thread Cournapeau David
Cournapeau David added the comment: I started a patch against the trunk to handle nan/inf/infinite (I have not yet tackled the problem of negative zero). The patch is a bit big, because I found the function quite difficult to follow, so I refactored it a bit first (replacing the state machine w

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

2008-03-01 Thread Mark Dickinson
Mark Dickinson added the comment: Signed zeros cause difficulties with round-tripping, too: >>> z = complex(-0.0, -0.0); w = complex(repr(z)) >>> z -0j >>> w -0j >>> z.real -0.0 >>> w.real 0.0 -- nosy: +marketdickinson __ Tracker <[EMAIL PROTECTED]>

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

2008-02-15 Thread Christian Heimes
New submission from Christian Heimes: This is a reminder. The issue makes the complex(repr(...)) round-trip impossible when either the real or imag part is nan or infinite. -- components: Interpreter Core messages: 62422 nosy: tiran priority: normal severity: normal status: open title: