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

Travis Oliphant oliphant at ee.byu.edu
Tue Feb 26 17:23:32 EST 2002


>

> 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).

Ah, for complex scalars.  Yes that would be nice.
>
> 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.

As you'll notice in the lastest CVS, this is the solution I finally
converged to as well..

-Travis







More information about the SciPy-Dev mailing list