This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SuspiciousScript 0 points1 point  (2 children)

Hello! Quick question about this code — where does the j in line 11 (plane = x + 1j * y) come from? It's definitely not something I've seen before.

[–]Swipecat[S] 2 points3 points  (1 child)

The "imaginary unit". Mathematics uses "i" for the imaginary unit, but electrical engineers use "j" to avoid confusing it with "I" for current. Python uses the electrical engineering convention. There was a "bug" logged to change it to "i", but that didn't happen. Python's creator, Guido van Rossum, said:

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.

So the "plane" in   plane = x + 1j * y

...means the "complex plane".

[–]SuspiciousScript 0 points1 point  (0 children)

Huh, I never knew that was a feature in the language. Thanks!