g.brandl at gmx.net
Sat Apr 19 23:23:36 CEST 2008
> On Sat, 19 Apr 2008 22:13:19 +1000
> Nick Coghlan <ncoghlan at gmail.com> wrote:
>> Being indexable is subtly different from being subscriptable - the
>> former has stronger connotations of numeric indices and sequence-like
> I dispute this. Indices aren't necessarily numeric (think of an A-Z
> file), and I don't believe you are correct about the connotations of
> indexable being numeric or sequence-like. Think of index cards.
In normal language use, perhaps -- I'm no native speaker. But in the
Python world, Nick is right -- think of the __index__ special method that
adapts the object to a sequence index; it has to return an integer.
> With my maths background, I would expect that subscripts are (almost)
> always numeric, e.g. x-subscript-i means the i-th x value, where i
> is a natural number.
Maths background isn't always directly transferable to computer
languages. Think 1 / 2 == 0 -- with terms, it's even worse.
An interesting point here is that the special methods are called
__getitem__ et al., smartly evading the problem. "'int' object
has no items" sounds equally strange to me though.
> +0 on keeping unsubscriptable.
> +1 on changing it to unidexable.
> -1 on keeping the current misspelling.
There is currently no misspelling.
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.
More information about the Python-Dev