On Oct 29, 2009, at 4:22 PM, Lisandro Dalcin wrote:

> Sorry for the late reply..
>
> On Wed, Oct 28, 2009 at 4:13 AM, Stefan Behnel <[email protected]>  
> wrote:
>> Hi,
>>
>> most of the 'complex' tests currently fail in Py3.1 because
>> complex.__repr__() became more correct. It now prints (-0-2j) for - 
>> (2j).
>>
>
> Are you sure this is "more correct" ? What's the point of printing a
> "0" for the real part?

I had the same thought.

> I really do not know what's going on there...
> Enter your python prompt ant try to make it print a complex with a
> single "0" for the real part, I was not able to do so...

I'm confused too

Python 3.0 (r30:67503, Jan 23 2009, 04:39:45)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> str(-2j)
'-2j'
 >>> repr(-2j)
'-2j'

Perhaps it's a 3.1+ thing.

>> Could someone who was involved in writing this code (Dag or  
>> Lisandro, I
>> guess) please take a look
>
> It was Robert :-)
>
>> and decide a) if this is worth testing for, and
>> b) if it's enough to fix the test or if the support in Cython also  
>> needs
>> adaptation to match what Py3.1 prints?

When I write

cdef double complex z = -2j
print z

it converts z into a Python complex object, then prints it. We don't  
do any string conversion ourselves. If they changed the was repr  
works, the only thing I see to do is change the doctest depending on  
the Python version.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to