[Python-Dev] Mini-Pep: Simplifying the Integral ABC
jyasskin at gmail.com
Sat Jun 7 05:25:03 CEST 2008
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.
>> Python-Dev mailing list
>> Python-Dev at python.org
> --Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev