[Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation (original) (raw)
Guido van Rossum guido at python.org
Fri Feb 10 02:54:41 CET 2006
- Previous message: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
- Next message: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2/9/06, Travis E. Oliphant <oliphant.travis at ieee.org> wrote:
Thomas Wouters wrote: > I have a slight reservation about the name. On the one hand it's clear the > canonical use will be for indexing sequences, and index doesn't look > enough like int to get people confused on the difference. On the other > hand, there are other places (in C) that want an actual int, and they could > use index too. Even more so if a PyArgParse* grew a format for 'the > index-value for this object' ;)
I think we should just change all the existing formats that require int or long to support nb_as_index.
There are other places in Python that check specifically for int objects and long integer objects and fail with anything else. Perhaps all of these should aslo call the index slot.
Right, absolutely.
But, then it should be renamed to i.e. "trueint". One such place is in abstract.c sequencerepeat function.
I don't like true_int very much. Personally, I'm fine with calling it index after the most common operation. (Well, I would be since I think I came up with the name in the first place. :-) Since naming is always so subjective and important, I'll wait a few days, but if nobody suggests something better then we should just go with index.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
- Next message: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]