Terry Reedy wrote:
> "Daniel Schüle" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
...
> > unfortunately there is no arg method to get the angle
> > of the complex number
>
> I agree that this is a deficiency.  I would think .angle() should be a
> no-param method like .conjugate(), though its internal implementation would
> need access to the appropriate cmath functions.

You need math, not cmath.

def arg(z):
   """The Argument of z, in radians."""
   z += 0j # make it work on real inputs
   return math.atan2(z.imag, z.real)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to