[Python-Dev] return type of complex (original) (raw)

Mark Dickinson dickinsm at gmail.com
Fri Oct 19 18:41:25 CEST 2012


On Fri, Oct 19, 2012 at 5:31 PM, Christian Heimes <christian at python.org> wrote:

In order to fix the bug the code in PyComplexAsCComplex() must be altered to support float as return type from complex(). That's a major change.

Agreed that this doesn't seem appropriate for bugfix releases.

We might also want to consider having PyComplex_AsCComplex check for float, again for consistency with the 'complex' constructor:

class A(object): ... def float(self): ... return 42.0 ... a = A() float(a) 42.0 complex(a) (42+0j)

Mark



More information about the Python-Dev mailing list