On 2/9/06, Travis E. Oliphant <[EMAIL PROTECTED]> 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 PyArg_Parse* 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. "__true_int__".  One such place
> is in abstract.c sequence_repeat 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/)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to