Bah. I meant to send this to the list. (I suspect that Nick also
meant to send his reply to the list.)
On Mon, Dec 27, 2010 at 12:43 PM, Mark Dickinson wrote:
> On Mon, Dec 27, 2010 at 12:23 PM, Nick Coghlan wrote:
>> The symmetry only breaks for a class that breaks the invariant:
>>
>> x ==
On Mon, Dec 27, 2010 at 11:52 AM, Terry Reedy 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
> What are the actual used of .__index__?
Can you please rephrase this question?
Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/py
On 12/26/2010 7:15 PM, Nick Coghlan wrote:
Starting in Python 3.2, range() supports fast containment checking for
integers (i.e. based on an O(1) arithmetic calculation rather than an
O(N) iteration through the entire sequence).
Currently, this fast path ignores objects that implement __index__
Starting in Python 3.2, range() supports fast containment checking for
integers (i.e. based on an O(1) arithmetic calculation rather than an
O(N) iteration through the entire sequence).
Currently, this fast path ignores objects that implement __index__ -
they are relegated to the slow iterative se