[SciPy-dev] New in fastumath ~ (means conjugate on floats and complex numbers)

arnd.baecker at physik.uni-ulm.de arnd.baecker at physik.uni-ulm.de
Tue Feb 26 16:32:28 EST 2002


On Tue, 26 Feb 2002, eric wrote:

[...]

> It might be possible to overload the ~ operator in Python2.2 for complex values
> so that it worked correctly (I haven't looked into the new type/class stuff
> much), but if we did, it is effectively a language change to Python.  In the
> complex number arena, I don't think it would break much code, but it does have
> that potential.  We need to think long and hard about such decisions and would
> do better to lobby Guido et al. about such a change (I sorely want a __cmp__ for
> complex numbers to work with some default behavior).
>
> But even if we got it fixed for complex scalars, the fact that conj_test(1,1)
> would return completely different results than conj_test(1+0j,1+0j) is a show
> stopper to me.  I'd be all for ~ universally meaning conjugate, but its been in
> the language for to long for this to happen.
>
> Could we shorten the name to conj()?  Its not as good as ~, but it does cut down
> on typing and is obvious to those who would use it.

Would there be an easy way for a user to redefine ~ (using conj())
to achieve the functionality (at his own risk) ?
And what about "conj()" -> "cc()" (with cc
standing for complex conjugate) to make it even shorter ?

Just my 0.02 Euro ...

Arnd




More information about the SciPy-Dev mailing list