You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
The second patch (python-complex-constructor.diff) changes
the constructor to accept bracketed complex numbers which
are enclosed in a single bracket. I'd rather say this is the
better appropach to have complex(repr(x)) work, but I leave
both patches attached to this bug.
The latter patch also creates test cases testing for
formatting errors with bracketed expressions.
(The current behavior is not a bug, nor is this patch
submission a bug report, so let us omit that word.)
I think your example suggests why complexes are printed in
parens, so I think enhancing complex() to accept such is
the better approach if any change is to be made.
The attached patch is a revised version of the patch to the
complex constructor to accept bracketed string expressions,
which also adds documentation changes (whatsnew25).
Anyway, I personally also find this to be the "better" way,
so I've removed the repr-changing patch. And, calling it a
bug was by accident: I should've rather called it tracker
item, which is pretty synonymous for me.
I have applied this patch in 2.6 and it seem to work as intended. The test_complex.py unit tests all pass. I guess the change could be useful if you are are serializing and desearializing lists of complex numbers. I think it should be applied.