Annoying error message

Gerrit Holl gerrit.holl at pobox.com
Sat Dec 4 17:14:39 EST 1999


Hello,

if one uses a dict that spans multiple lines, the error message produced
can be very annoying:

23:11:20:5/505:gerrit at stopcontact:~$ python /tmp/a.py
Traceback (innermost last):
  File "/tmp/a.py", line 3, in ?
    d = {'a': 1,
NameError: c
23:11:27:7/507:gerrit at stopcontact:~$ cat /tmp/a.py
#!/usr/bin/python

d = {'a': 1,
     'b': 2,
     c: 3}

IMO, the Python traceback should say this instead:
Traceback (innermost last):
  File "/tmp/a.py", line 5, in ?
    d = {'a': 1,
         'b': 2,
         c: 3}
NameError: c

or:
  File "/tmp/a.py", line 3-5, in ?

or:
    d = {'a': 1,
    ...			# I mean this literally.
    c: e}

because sometime dictionaries span MANY lines.

That's much more clear when debugging.

Or does that have major disadvantages?

regards,
Gerrit.

-- 
"The move was on to 'Free the Lizard'"

  -- Jim Hamerly and Tom Paquin (Open Sources, 1999 O'Reilly and Associates)
 11:09pm  up 46 min,  8 users,  load average: 0.00, 0.00, 0.00




More information about the Python-list mailing list