Benjamin Peterson wrote:
> On Fri, Apr 18, 2008 at 5:43 PM, Benjamin Peterson
> <[EMAIL PROTECTED]> wrote:
>> Consider this error:
>> >>> 3["something"]
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> TypeError: 'int' object is unsubscriptable
>>
>> "unscriptable" seems rather ambiguous. How about "[object] cannot be
>> indexed"?
> Titus just noticed that I confused "unscriptable" with
> "unsubscriptable." :P Still, though, unsubscriptable seems to be a
> Python invented word.
> What does (un)subscriptable even mean?
You can't pass the object a subscript (the expression between the square
brackets) and get a meaningful answer.
Being indexable is subtly different from being subscriptable - the
former has stronger connotations of numeric indices and sequence-like
behaviour (particularly since the introduction of operator.index), while
the latter merely states that the container provides some kinds of
mapping from subscripts to values in the container, without provide any
implications as to the nature of that mapping.
'Unsubscriptable' may be a bit clumsy, but it's as accurate a
description of the error as you're likely to find.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com