Nitpicking - slightly misleading traceback

2006-01-26 Thread Juho Schultz
if ((data[x][y] 0) or (datadict.has_key[key])): Traceback (most recent call last): File reduce.py, line 524, in remove_badvalues if ((data[x][y] 0) or TypeError: unsubscriptable object However, the bug sits on the next line. I used square brackets when normal brackets were needed

Re: Nitpicking - slightly misleading traceback

2006-01-26 Thread Sybren Stuvel
Juho Schultz enlightened us with: However, the bug sits on the next line. [...] I feel the traceback is misleading. Well, the bug sits in the command starting on the line indicated. Nitpick back: Learn about operator precedence and Python syntax rules. You don't need so many brackets: if

Re: Nitpicking - slightly misleading traceback

2006-01-26 Thread Alex Martelli
Sybren Stuvel [EMAIL PROTECTED] wrote: ... if data[x][y] 0 or datadict.has_key(key): This might even make things fit on one line again ;-) Particularly if you code it idiomatically: if data[x][y] 0 or key in datadict: Alex -- http://mail.python.org/mailman/listinfo/python-list