[Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
Nick Coghlan
ncoghlan at gmail.com
Tue Feb 14 13:08:47 CET 2006
Guido van Rossum wrote:
> On 2/10/06, Mark Russell <mrussell at verio.net> wrote:
>> On 10 Feb 2006, at 12:45, Nick Coghlan wrote:
>>
>> An alternative would be to call it "__discrete__", as that is the key
>>
>> characteristic of an indexing type - it consists of a sequence of discrete
>>
>> values that can be isomorphically mapped to the integers.
>> Another alternative: __as_ordinal__. Wikipedia describes ordinals as
>> "numbers used to denote the position in an ordered sequence" which seems a
>> pretty precise description of the intended result. The "as_" prefix also
>> captures the idea that this should be a lossless conversion.
>
> Aren't ordinals generally assumed to be non-negative? The numbers used
> as slice or sequence indices can be negative!
The other problem with 'ordinal' as a name is that the term already has a
meaning in Python (what else would 'ord' be short for?).
I liked index from the start, but I thought we should put at least a bit of
effort into seeing if we could come up with anything better. I don't really
see any way that either 'discrete' or 'ordinal' can be said to qualify as
better :)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-Dev
mailing list