[Python-Dev] unscriptable?
Steve Holden
steve at holdenweb.com
Sun Apr 20 03:54:46 CEST 2008
Nick Coghlan wrote:
[...]>
> To suggest yet another colour for the bikeshed, maybe we should ditch
> both unindexable and unsubscriptable and go with "'int' is not a
> sequence or mapping". Any object which supports subscript notation will
> be one or the other.
>
All the object needs to to to be "indexable" or "subscriptable" is to
implement .__index__() or .__getitem__(). While sequences and mappings
are the only built-in types to do so, this says nothing about
user-defined types.
Couldn't we find a more obvious and direct error message like
"Illegal use of [] subscripting/indexing"?
one-more-coat-for-the-bikeshed-ly y'rs - steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-Dev
mailing list