complex numbers

It's me itsme at
Tue Jan 11 23:22:00 EST 2005

"Robert Kern" <rkern at> wrote in message
news:cs1mp9$sg9$1 at
> That's *it*.

So, how would you overload an operator to do:

With native complex support:

def  twice(a):
    return 2*a

print twice(3+4j), twice(2), twice("abc")

Let's presume for a moment that complex is *not* a native data type in
Python.  How would we implement the above - cleanly?

More information about the Python-list mailing list