[Python-Dev] Semantics of __int__(), __index__()
francis
francismb at email.de
Sun Mar 31 21:13:59 CEST 2013
More information about the Python-Dev mailing list
Sun Mar 31 21:13:59 CEST 2013
- Previous message: [Python-Dev] Semantics of __int__(), __index__()
- Next message: [Python-Dev] [Python-checkins] cpython (2.7): Add an itertools recipe showing how to use t.__copy__().
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> and two instances > i1 = Int1() > i2 = Int2() > > we get the following behaviour: > > >>> type(int(i1)) > <class 'int'> > > I would have expected 'Int1' >>> type(float(i1)) <type 'float'> >>> type(float(i2)) <class 'float'> >>> isinstance(int(i1), int) True >>> isinstance(int(i2), int) new <class '__main__.Int2'> True >>> isinstance(float(i1), float) True >>> isinstance(float(i2), float) True why is printing new <class '__main__.Int2'>?
- Previous message: [Python-Dev] Semantics of __int__(), __index__()
- Next message: [Python-Dev] [Python-checkins] cpython (2.7): Add an itertools recipe showing how to use t.__copy__().
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list