[Python-Dev] unsubscriptable vs object does not support indexing
Steven D'Aprano
steve at pearwood.info
Thu Sep 24 01:33:08 CEST 2009
On Thu, 24 Sep 2009 06:47:41 am Dino Viehland wrote:
> > 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.
For what it's worth, "unsubscriptable object" seems to me to be
mysterious to many newbies, and even a few non-newbies. It took me
something like seven years of coding to stop reading it
as "unscriptable object", and I'm sure I won't be the only one.
As far as I can see, in practice, people talk about obj[i] as the item
at index i, not the item at subscript i -- the term "subscript" in this
context seems to be rare to non-existent except for the error message.
--
Steven D'Aprano
More information about the Python-Dev
mailing list