why no arg, abs methods for comlex type?

Dan Sommers me at privacy.net
Fri Aug 5 17:14:31 CEST 2005


On Fri, 05 Aug 2005 15:42:41 +0200,
Daniel Schüle <uval at rz.uni-karlsruhe.de> wrote:

> Hello all,
> I often have to deal with complex numbers
> using python iteractive as calculator

> 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

I guess it's for the same reason that we are spared
from writing things like this:

    z = x.squared().added_to(y.squared()).squareroot()
    E = m.multiplied_by(c.squared())

More OO, yes.  More readable, not IMO.

> I would also like to see some more functions to make
> calculations with complex number more convenient

[ ... ]

> maybe there exists some proposals aiming this goal?

SciPy or Numeric?

Regards,
Dan

-- 
Dan Sommers
<http://www.tombstonezero.net/dan/>



More information about the Python-list mailing list