[Python-Dev] various unix platform build/test issues (original) (raw)

Tim Peters tim.one@comcast.net
Thu, 20 Feb 2003 12:24:50 -0500


[M.-A. Lemburg]

Isn't that caveat in the complex implementation ? Converting a complex with 0 img part would not cause any loss of information (apart from the usual integer truncations ;-)

Hmm. Have you ever met a coercion you didn't like <0.9 wink>? float(complex) also raises an exception unconditionally, and I think for good reasons -- what someone intends by trying to convert a complex number to a float or an int is a mystery. The exceptions raised suggest one plausible intent and how to get at it clearly:

float(1+0j) Traceback (most recent call last): File "", line 1, in ? TypeError: can't convert complex to float; use e.g. abs(z)