[Python-Dev] Mini-Pep: Simplifying the Integral ABC

Guido van Rossum guido at python.org
Sat Jun 7 19:30:16 CEST 2008


I recommend switching back to __int__ and int; even in 2.5, these are
expected to return either an int or a long as required. There's no
need to mess with __long__ at all.

On Fri, Jun 6, 2008 at 8:25 PM, Jeffrey Yasskin <jyasskin at gmail.com> wrote:
> Well, it seems like Integral instances should be able to be passed to
> either int() or long(), so __long__ should probably stay. I have no
> idea why I didn't include __int__, but its absence was probably the
> only reason __index__ calls long() instead of int().
>
> On Fri, Jun 6, 2008 at 3:23 PM, Guido van Rossum <guido at python.org> wrote:
>> Both of these seem 2.6-specific quirks. Those lines wereJeffrey's;
>> maybe he remembers? I'm guessing that adding __long__ was done since
>> 2.6 supports it, and the removal of __int__ was an oversight.  I also
>> think that there's no reason to change __index__ to call long(); int()
>> will automatically return a long as needed. Maybe changing __long__
>> back to __int__ is also harmless.
>>
>> On Fri, Jun 6, 2008 at 2:13 PM, Raymond Hettinger <python at rcn.com> wrote:
>>> From: "Guido van Rossum" <guido at python.org>
>>>>
>>>> Make that int() instead of long() and I'm okay with it.
>>>
>>> Does anyone know why Integral says that __long__ is a required abstract
>>> method, but not __int__?
>>>
>>> Likewise, why is index() defined as long(self) instead of int(self)?
>>>
>>> There may be some design nuance that I'm not seeing.
>>>
>>>
>>> Raymond
>>> _______________________________________________
>>> Python-Dev mailing list
>>> Python-Dev at python.org
>>> http://mail.python.org/mailman/listinfo/python-dev
>>> Unsubscribe:
>>> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>>>
>>
>>
>>
>> --
>> --Guido van Rossum (home page: http://www.python.org/~guido/)
>>
>
>
>
> --
> Namasté,
> Jeffrey Yasskin
> http://jeffrey.yasskin.info/
>



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list