Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment:

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.

----------
nosy: +josh.r

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

Reply via email to