Python complaints

Aahz Maruch aahz at netcom.com
Thu Dec 16 11:31:56 EST 1999


In article <3858FEA3.E593F38C at callware.com>,
Ivan Van Laningham  <ivanlan at callware.com> wrote:
>Charles Boncelet wrote:
>>
>> What kind of number is allowed?  Can x be an integer, a float, complex,
>> long, hex?  There is no way to know, without doing the experiment.
>> BTW, experimentation indicates that it fails if x is complex and works
>> for the others. sin seems to be promoting its argument to a float and
>> taking the sine.  However, sin(complex) is a perfectly good mathematical
>> operation.  It should work.
>
>Use
>	import cmath
>
>and
>	s=cmath.sin(c) 
>
>All of the standard math functions that live in math.py have
>correspondent functions in cmath.py.

That's precisely the problem Charles was complaining about -- how the
heck are you supposed to know this?  And why should you need to know
this?  (I actually know the answer to the latter question, but I figure
the Timbot has nothing better to do....  ;-)
--
                      --- Aahz (@netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

TEOTWAWKI -- 16 days and counting!



More information about the Python-list mailing list