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 josh.r
Recipients josh.r, nagayev
Date 2019-03-07.21:01:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1551992462.95.0.686079033563.issue36228@roundup.psfhosted.org>
In-reply-to
Content
They already have a .real attribute to extract the real part, which you can call int on. I suspect the lack of support for float/int coercion is intentional; coercing float to int loses precision, but it's still a fundamentally similar value. Implicitly dropping the imaginary component of a complex number isn't just losing precision, it's fundamentally altering the value (in a way that isn't necessarily obvious).

Similarly, there is no meaningful concept of floor/ceil for complex ( https://math.stackexchange.com/q/2095674/332927 ), so implementing it would involve the same data loss as float/int coercion.

complex numbers are complex, and silently ignoring that just makes it easier to write incorrect code. People can do whatever they want with .real explicitly, but we shouldn't be helping them make mistakes.
History
Date User Action Args
2019-03-07 21:01:02josh.rsetrecipients: + josh.r, nagayev
2019-03-07 21:01:02josh.rsetmessageid: <1551992462.95.0.686079033563.issue36228@roundup.psfhosted.org>
2019-03-07 21:01:02josh.rlinkissue36228 messages
2019-03-07 21:01:02josh.rcreate