News for hackers. Stuff that matters.
Re:Worst Bug Ever by andreasvc on Monday January 21, 2013 @12:14PM (#5092383)
It will only give that NameError if 'j' is in fact undefined; 'j' can be used as a variable which would lead to a similar bug in Python (and why is it 'j' instead of 'i' ... they're both common one-letter variables).
Re:Worst Bug Ever by nemetroid on Monday January 21, 2013 @12:23PM (#5092443)
The difference is that in Matlab, 1 + j is valid as a complex literal and equal to 1 + 1j. In Python it is never valid to write j as an implicit 1j, so this particular bug (a correctly working function stops working because you've put a new name into scope) can't arise.

The use of j is common in electrical engineering, where i denotes current.

Re:Worst Bug Ever by DoubleMalt on Monday January 21, 2013 @12:20PM (#5092417)
Electrical engineers use j instead of i to distinguish it from current (that is commonly referenced by i).
Re:Worst Bug Ever by shardling on Monday January 21, 2013 @01:47PM (#5092949)
Whereas physicists use capital I for current. (And J for the current density.)
Re:Worst Bug Ever by fosap on Monday January 21, 2013 @06:29PM (#5094410)
I have seen j for current density only so far. But physics are convinced you can tell the difference by context (which is usually true, but probably impossible for a compiler, even if physics is "typed" with units). For handwritten text at least my professors managed to come up with at least two different ways to write each letter to avoid confusion. My (not serious) attempts to use Chinese characters haven't been very successful.
Re:Worst Bug Ever by d0mine on Monday January 21, 2013 @07:28PM (#5094676)
It won't lead to the bug: `j` has no connection to `1j`.

The bug described in the article is impossible in Python (and probably in most other programming languages with native support for complex numbers) because `1j` is not a valid identifier.

Re:Worst Bug Ever by jerf on Monday January 21, 2013 @12:26PM (#5092462)
j is the abbreviation used by some disciplines; see the third paragraph of http://en.wikipedia.org/wiki/Imaginary_unit .