[Python-Dev] unsubscriptable vs object does not support indexing

Brett Cannon brett at python.org
Wed Sep 23 23:24:53 CEST 2009


On Wed, Sep 23, 2009 at 13:47, Dino Viehland <dinov at microsoft.com> wrote:
> Brett wrote:
>> Let's ignore history, which I bet is the reason for the distinction,
>> and just look at the error messages; does the distinction make sense
>> to a newbie? I would say no and that the "does not support indexing"
>> error message is more useful. For expert programmers they could figure
>> out the problem with either error message. The only help is if you are
>> trying to debug a type, but I am willing to bet most of us didn't know
>> the distinction at the C level until David looked it up.
>>
>> So I am +1 on unified the message and +1 on using the "does not
>> support indexing" one.
>
> I'd be +1 on the unified message as well - but it seems what that message
> should be may be contentious (and quite a bike shed discussion at that).
> The bug David linked to (http://bugs.python.org/issue5760) has a
> preference for subscript because that's what's used elsewhere in the
> language.

That's what's used in the language spec which VERY few people read.
That can use more technical jargon, but I still don't see experienced
programmers having issuesvfiguring out that note being able to index
an object is the same as not being subscriptable. And we can change
the docs as well if needed, but I don't think that is necessary.

-Brett


More information about the Python-Dev mailing list