This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients eric.smith, mark.dickinson
Date 2009-04-23.08:35:50
SpamBayes Score 2.220446e-16
Marked as misclassified No
Message-id <1240475755.09.0.337248337965.issue5816@psf.upfronthosting.co.za>
In-reply-to
Content
Updated patch:

4. also simplify complex printing:  no special handling for nans or
   infinities.  This means that e.g. complex(1, inf) prints as

   "1 + infj" instead of "1+inf*j".

   This might look ugly, but I think it's better than what was there
   before.  Complex reprs are now more uniform and easier to parse
   by external code.  And the expression "1 + inf*j" doesn't give
   the right thing anyway, even if you replace j by 1j and inf by
   float(inf):

>>> inf = float('inf')
>>> 1 + inf*j
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'j' is not defined
>>> 1 + inf*1j  # expect (1+infj), but get nan in real part:
(nan+infj)

   Furthermore, with these simplifications to printing and
   parsing, roundtripping now works:  the output of repr(z)
   is valid input to      

5. Print real part if it's negative zero: z =complex(-0.0, 0.0)
   now prints as -0 + 0j instead of just 0j, so again roundtripping
   works: complex(repr(z)) recovers z exactly.

6. Change PyOS_ascii_strtod to always output a sign when requested,
   even for nans.  As far as I can tell, the complex formatting is
   the only place that's affected by this.  Eric?
History
Date User Action Args
2009-04-23 08:35:55mark.dickinsonsetrecipients: + mark.dickinson, eric.smith
2009-04-23 08:35:55mark.dickinsonsetmessageid: <1240475755.09.0.337248337965.issue5816@psf.upfronthosting.co.za>
2009-04-23 08:35:53mark.dickinsonlinkissue5816 messages
2009-04-23 08:35:52mark.dickinsoncreate