[Python-Dev] unsubscriptable vs object does not support indexing
fuzzyman at voidspace.org.uk
Wed Sep 23 23:49:38 CEST 2009
Brett Cannon wrote:
> On Wed, Sep 23, 2009 at 14:19, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
>> Also +1. I had a friend (an experienced programmer) who started using Python
>> recently. The cryptic nature of some of the error messages was a sore point
>> with him.
> Do you know which error messages? We can change them. We have always
> said that we view exception messages as something that can change in
> minor releases and that you should be very careful if you ever use
> them in tests.
There were a couple and I can only remember the last one he talked
about. He ran some code with "python -3" that used someone else's
library and resulted in the following warning, that he felt was cryptic:
DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__
Hmm... not entirely sure how we can make it clearer. There is a great
blog entry on the subject by Eric Lippert though (Microsoft I'm afraid):
Error messages: diagnostic is preferable to prescriptive
* Polite: making the user feel like an idiot is very, very bad.
* Readable: poor grammar and tortured sentence structure is bad.
* Accurate: error messages must accurately describe the problem.
* Precise: "Something is wrong" is an accurate error message but not
a very precise one!
* Diagnostic but not prescriptive: describe the problem, not the
How about (?):
If you implement equality (__eq__) you should also implement hashing
(__hash__), it won't be inherited in 3.x.
Although that is prescriptive of course...
More information about the Python-Dev