"Daniel Schüle" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I wonder why there are no methods like arg, abs

> well one can use
> c = 1+1j
> abs(c)
>
> In my opinion it would also be nice to have the
> possibility to write it as
> c.abs()
> it looks more OO

Python is object based but not rigidly OO in syntax or looks.  This is an 
intentional design decision.  Not being gratuitiously redundant is another.

> 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.  I think returning radians 
might be enough though.  You could submit to the SourceForge tracker a RFE 
(Request For Enhancement) if not a patch.

> I would also like to see some more functions to make
> calculations with complex number more convenient
> e.g.
> c = 27
> c.pow(numerator = 1, denominator = 3,
>       mode = cmath.EULER, angle_mode = cmath.GRAD)
> -> ((3,0), (3,120), (3,240))

Wanting all roots is fairly specialized.  sqrt(4) is 2, not (2, -2).

> what do you think about it?
> maybe there exists some proposals aiming this goal?

Have you looked for complex math functions in numpy, numarray, scipy or 
similar packages?  It is possible that a cmath2 module, written in Python, 
could be useful.

Terry J. Reedy




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

Reply via email to