[Python-Dev] Semantics of int(), index() (original) (raw)
Maciej Fijalkowski fijall at gmail.com
Tue Apr 2 10:58:58 CEST 2013
- Previous message: [Python-Dev] Semantics of __int__(), __index__()
- Next message: [Python-Dev] Semantics of __int__(), __index__()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Apr 2, 2013 at 10:53 AM, Mark Dickinson <dickinsm at gmail.com> wrote:
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. The question is whether / how to fix the current behaviour, given that it doesn't conform to those ideal semantics. Mark
My 2 cents here is that which one is called seems to be truly random. Try looking into what builtin functions call (for example list.pop calls int, who knew)
- Previous message: [Python-Dev] Semantics of __int__(), __index__()
- Next message: [Python-Dev] Semantics of __int__(), __index__()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]