On Mon, Dec 27, 2010 at 11:52 AM, Terry Reedy <[email protected]> wrote:
> Return a converted to an integer. Equivalent to a.__index__()."
> comes close to implying equality (if possible).
>
> What are the actual used of .__index__?

PEP 357 gives the original rationale - it was to allow integer-like
objects (such as numpy scalars) to be used as sequence indices, as
well as slice parameters.

I would have to grep the source to get a full list of uses, but I
believe it is already used in at least those two cases, as well as for
sequence repetition (via '*') and to identify permitted inputs to
bin/oct/hex.

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
[email protected]
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