News for hackers. Stuff that matters.
Re:A C Heisenbug in the wild by icecommander on Sunday June 12, 2011 @03:06PM (#2647131)
The Python analog would be something like this:

assert (object() < object()) == False

(try running this in the interpreter a few times)

Re:A C Heisenbug in the wild by leot on Sunday June 12, 2011 @11:15PM (#2647982)
Not really.

The example given is equivalent in badness to:

  g = Timer()
  assert g.startTimer() == 0
... and then wondering why the timer doesn't start when you run your program in "optimized" mode.
Re:A C Heisenbug in the wild by coconutrandom on Sunday June 12, 2011 @04:57PM (#2647382)
Woah... so this is coercing it to a string and the address in hex is being compared. Am I off on this?
Re:A C Heisenbug in the wild by leot on Sunday June 12, 2011 @11:19PM (#2647991)
Yes. Python is not that mysterious.

For generic objects, the __lt__ and __gt__ methods are simply defined the only way that's sensible, which is effectively as a pointer location comparison.