Vedran Čačić added the comment:

Yes, but IMO that's a separate issue. And if complex analysis has taught me 
anything, it's that the sign of zero of .imag is much more important than the 
sign of zero of .real part (most elementary functions have branch cuts along 
real axis, where sign of .imag ensures continuity on both sides). Of course, 
having both would be even better, but having only this part is a good part of a 
good thing.

However, as I said, I know it's complicated. How about giving a "conventional" 
repr to complex? As far as I see, it's really not hard to implement - the only 
problem is backwards compatibility. But that was a problem when parentheses 
were added, too, right?

[ And there would be one more benefit: We could finally say goodbye to  weird 
"names" (infj, nanj) in the repr. By analogy with float, this could just be 
complex('nan', '-inf') or whatever. ]

For what it's worth, I'm not sure we should try too hard to preserve 
complex(repr(z)) being z given isinstance(z, complex). For example, Fraction 
and Decimal don't have this property (while it does kinda hold for str instead 
of repr, and it would continue to kinda hold for str here). Yes, I know 
Fraction and Decimal aren't builtins and complex is, but I really think it's 
only because of syntax support for j-based literals.

----------

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

Reply via email to