[Python-Dev] return type of complex (original) (raw)

Chris Angelico rosuav at gmail.com
Mon Oct 22 05:25:45 CEST 2012


On Mon, Oct 22, 2012 at 11:10 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

Steven D'Aprano wrote:

When you're dealing with numbers that represent real quantities, getting a complex result is nearly always an error condition. Better to get an exception at the point that occurs, than somewhere distant when the number gets fed to %f formatting, or worse, no error at all, just a silently generating garbage results. Yeah. I don't think Inland Revenue would be very impressed if I tried to tell them I had imaginary tax-to-pay, advantageous though it might be for me.

Unless the IRS instructs you to submit the square root of your income, I doubt that this will ever come up. Amusing though the notion be.

There really aren't that many situations where a program will be completely oblivious of complex/imaginary numbers and be able to encounter them... are there?

ChrisA



More information about the Python-Dev mailing list