the bugs that try men's souls

Jordan Rastrick jrastrick at student.usyd.edu.au
Tue Apr 5 03:35:51 EDT 2005


Sean McIlroy wrote:
> <later>
> Wow again. I had a real "V8 moment" when I looked at your solution
> (smacking my forhead, groaning ruefully, etc). You were right: my
> intention was simply to hide the trivial cases from view; I
completely
> missed the fact that I was now testing for membership in a different
> set. I should have remembered that python "plays fair", and looked a
> little harder to find my mistake.
>
> Thanks again,
> Sean

You're most welcome, I'm glad the solution was the right one.

Its the kind of bug you can stare at mindlessly for hours without
spotting it, but which will often be reasonably transparent to someone
with a fresh perspective on the code.

I had a doozy myself the other night, writing a mergesort for python's
deque class (I can't believe it doesnt come with one!).... the method
would yield a queue with the right elements in it, but in a seemingly
arbitrary order.

Turns out, there was a > sign that needed to be a >= sign. GRRRRRRR.

I bet if I'd posted to this group it would have been spotted in about 3
seconds flat :)

- Jordan




More information about the Python-list mailing list