I know this is an electrical engineering convention, but I\'m still wondering why it was chosen for Python. I don\'t know other programming languages with complex-number lit
Python adopted the convention used by electrical engineers. In that field, i
is used to represent current and use j
as the square root of -1.
There was a bug logged to change it to i
in Python 3.3. It was resolves as a "WONTFIX" with this reasoning by Guido van Rossum:
This will not be fixed. For one thing, the letter 'i' or upper case 'I' look too much like digits. The way numbers are parsed either by the language parser (in source code) or by the built-in functions (int, float, complex) should not be localizable or configurable in any way; that's asking for huge disappointments down the road. If you want to parse complex numbers using 'i' instead of 'j', you have plenty of solutions available already.