[SciPy-Dev] ndimage and from __future__ import division

Christopher Hanley chanley@stsci....
Wed Apr 28 12:32:43 CDT 2010


On Tuesday, April 27, 2010, Stéfan van der Walt <stefan@sun.ac.za> wrote:
> Hi Chris
>
> On 23 April 2010 03:31, Christopher Hanley <chanley@stsci.edu> wrote:
>> In preparation for our next release we are preparing to support Python
>> 2.6 with __future__ division.  Since I was one of the last STScI folks
>> to touch scipy I was tasked with looking into how ndimage would work
>> with "from __future__ import division" added.   All of the existing
>> tests pass with the exception of 2:
>
> I looked through all the division operators in ndimage, and it seems
> Peter consistently used "//" for integer division.  Since the C code
> is not influenced, you should be safe.
>
> The only case I wasn't sure about is this line from morphology.py:
>
>     pos = [ni * (structure.shape[ii] / 2) for ii in range(len(shape))]
>
> Since you now get two errors, I suspect the problem might be with the
> way the unit tests are constructed (I haven't checked how they used
> division).

Hi Stefan,

I believe you are correct. I've already corrected one of the tests
that was an obvious example. I still need the time to work on the
second.   I will commit my fixes to the scipy.ndimage unit tests when
finished.

Thank you for looking into this for me and validating my perception.

Cheers,
Chris
>
> Regards
> Stéfan
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>

-- 
Christopher Hanley
Senior Systems Software Engineer
Space Telescope Science Institute
3700 San Martin Drive
Baltimore MD, 21218
(410) 338-4338


More information about the SciPy-Dev mailing list