[Numpy-discussion] Going toward time-based release ?

Eric Firing efiring@hawaii....
Mon May 12 14:05:25 CDT 2008


Jarrod Millman wrote:
[...]
> 
> It is very clear that our users are not happy with the amount of API
> breaks in 1.1.  All I can say, is that I am sorry that the current
> release is going to break some code bases out there.  I am trying to
> figure out if there is a way to mitigate the problems caused by this
> release and would be happy to hear comments about how we could best
> reduce the problems caused by this release.  In particular, it would
> be useful if I could get some feedback on my suggestion about the MA
> transition.

Jarrod,

As one who pushed for the MA transition, I appreciate your suggestion. 
It may have one unintended consequence, however, that may cause more 
trouble than it saves: it may lead to more situations where the ma 
versions are unintentionally mixed.  This will probably work if an 
old_ma array ends up as input for a new_ma function, but the reverse 
often will not work correctly.  (Pierre GM tried to make his MaskedArray

Here is an illustration (untested, but should show the problem):

module1.py:
-----------
import numpy.core.ma as ma # with your suggestion, imports old_ma
def dummy(arr):
     return ma.sin(arr)

script.py:
-----------
from module1 import dummy
from pylab import *  # now ma is new_ma
x = ma.array([1,2,3], mask=[True, False, False])
plot(dummy(x))

The earlier strategy, of putting the old version solely in oldnumeric, 
is somewhat less likely to cause the problem because it requires anyone 
wanting the old version to deliberately select it--so at least the 
person is then aware that something has changed.

Eric






More information about the Numpy-discussion mailing list