[Python-Dev] Re: [Python-checkins] python/dist/src/Objects complexobject.c,2.57,2.58
Raymond Hettinger
python@rcn.com
Mon, 15 Apr 2002 11:13:13 -0400
[Tim]
> Does it make sense to deprecate divmod() and // for complex numbers while
> leaving % intact?
[GvR]
It doesn't, and I've repaired this.
[GvR]
However, I'm wondering what to do after we unify all numeric types
(*if* we ever decide to do that, which isn't clear). At that point,
should these operators be allowed as long as the imaginary part is
zero?
[RDH]
Yes.
Ideally, in a unified numeric model, all math operations should
accept all numeric types and raise a domain exception (ValueError: math
domain error) when an argument falls outside the defined scope just like we
do
for divide by zero, logs of negative numbers, and inverse trig functions
which fall outside a defined domain.
.real, .imag, and .conjugate() should be defined for integers and floats as
well as complex numbers: (3).imag --> 0
Likewise, divmod() and // should work for complex numbers where the
imaginary part is zero.
Raymond Hettinger