"Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
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?
The way it's implemented now. See the file Object/complexobject.c for details. Numeric operations on ints, longs, floats, and complex numbers are all implemented using operator overloading.
There's nothing special about the complex object. One can even remove it from the language quite easily. Some of the embedded versions of Python have in fact done so.
-- Robert Kern [EMAIL PROTECTED]
"In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list