Mark Dickinson <dicki...@gmail.com> added the comment:

> I tried to make repr of floats producing a string which rounds up with eval()

We've looked at this before. There just isn't any sane and easy way to do this, 
except for changing the repr to be "complex(real, imag)", which is the solution 
that I favour.

And this seems like a non-starter to me:

    >>> complex(0.0, -0.0)
    -(-0.0-0j)

This is a case where the cure is worse than the disease.

We should also not change the repr lightly: the last time it was changed, it 
caused disruption at least for Cython, and probably for NumPy too. As a 
corollary, if we _do_ change it, we should make sure we get it right so that 
we're changing it to something we're not going to want to change again in 5 
years' time. And I suspect that if we don't solve the underlying roundtrip 
problem, then this is going to come up again.

I'm +1 on changing the repr to "complex(..., ...)", +0 on modifying it to 
always include both real and imaginary parts _and_ format those parts as though 
they're floats; -1 on other changes.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40269>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to