[Python-Dev] Semantics of __int__(), __index__()
solipsis at pitrou.net
Tue Apr 2 11:01:20 CEST 2013
Le Tue, 2 Apr 2013 09:53:41 +0100,
Mark Dickinson <dickinsm at gmail.com> a écrit :
> On Tue, Apr 2, 2013 at 9:33 AM, Mark Shannon <mark at hotpy.org> wrote:
> > Hence my original question: what *should* the semantics be?
> I like Nick's answer to that: int *should* always return something of
> exact type int. Otherwise you're always left wondering whether you
> have to do "int(int(x))", or perhaps even "int(int(int(x)))", to be
> absolutely sure of getting an int.
More information about the Python-Dev