29 Nov
2016
29 Nov
'16
7:41 a.m.
I'm +1 to the idea of improving error messages :) (but maybe not to the exact new error messages proposed) Raymond Hettinger touched on this topic during his Pycon Canada keynote, as one of the positive contributions that you can do to cpython.
Traceback (most recent call last):
File "foo.py", line 2, in <module>
print(length(l))
NameError: name 'length' is not defined
A better message might be:
Python doesn't recognise the function "length". Did you mean len?'
I recall he gave a similar example to this, where Python could suggest an alternative in case of typo.