A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-December/107022.html below:

[Python-Dev] Range __contains__ and objects with __index__ methods

[Python-Dev] Range __contains__ and objects with __index__ methods [Python-Dev] Range __contains__ and objects with __index__ methodsNick Coghlan ncoghlan at gmail.com
Mon Dec 27 07:13:16 CET 2010
On Mon, Dec 27, 2010 at 11:52 AM, Terry Reedy <tjreedy at udel.edu> 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   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4