Jeffrey Yasskin wrote: > This interpretation implies that complex should provide __float__() to > return the non-imaginary portion of a complex number. Is that what you > intend? No, please don't. If somebody wants to implement __float__ for complex numbers please define it as hypot(complex) / sqrt(c.real**2 + c.img**2). In my opinion float(complex) does do the most sensible thing. It fails and points the user to abs(). >>> float(complex(1,1)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can't convert complex to float; use abs(z) >>> abs(complex(1,1)) 1.4142135623730951
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4