[issue36228] Support coercion of complex to float/int

Марат Нагаев report at bugs.python.org
Fri Mar 8 04:44:41 EST 2019


Марат Нагаев <sidorovmarat1995 at gmail.com> added the comment:

Oh, __floor__ can return anything.
So I suggest:
1. Methods __floor__ and __ceil__ for complex object.
2. Don't change __float__ and __int__ methods.
3. So I think it isn't nessesary to add methods floor and ceil to complex module.
Example:
from math import *
z=1.1+1.1j
floor(z) #1+1j, same as z.__floor__()
ceil(z) #2+2j, samse as z.__ceil__()

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36228>
_______________________________________


More information about the Python-bugs-list mailing list