[Numpy-discussion] Handling of backward compatibility

Sebastian Haase haase at msg.ucsf.edu
Wed Aug 2 23:55:34 CDT 2006

Travis Oliphant wrote:
> Torgil Svensson wrote:
>>> They are supposed to have different defaults because the functional
>>> forms are largely for backward compatibility where axis=0 was the default.
>>> -Travis
>> Isn't backwards compatibility what "oldnumeric" is for?
> As this discussion indicates there has been a switch from numpy 0.9.8 to 
> numpy 1.0b of how to handle backward compatibility.   Instead of 
> importing old names a new sub-package numpy.oldnumeric was created.  
> This mechanism is incomplete in the sense that there are still some 
> backward-compatible items in numpy such as defaults on the axis keyword 
> for functions versus methods and you still have to make the changes that 
> convertcode.py makes to the code to get it to work.
> I'm wondering about whether or not some additional effort should be 
> placed in numpy.oldnumeric so that replacing Numeric with 
> numpy.oldnumeric actually gives no compatibility issues (i.e. the only 
> thing you have to change is replace imports with new names).     In 
> other words a simple array sub-class could be created that mimics the 
> old Numeric array and the old functions could be created as well with 
> the same arguments.
> The very same thing could be done with numarray.  This would make 
> conversion almost trivial. 
> Then, the convertcode script could be improved to make all the changes 
> that would take a oldnumeric-based module to a more modern numpy-based 
> module.   A similar numarray script could be developed as well.
> What do people think?  Is it worth it?   This could be a coding-sprint 
> effort at SciPy.
> -Travis
Just as thought of cautiousness:
If people actually get "too much" encouraged to just always say
" from numpy.oldnumeric import *  "
or as suggested maybe soon also something like
" from numpy.oldnumarray import *  "
- could this not soon lead to a great state of confusion when later 
people on this mailing list ask questions and nobody really knows which 
of the submodules they are referring to !?

Recently someone (Torgil Svensson) here suggested to unify the default 
argument between a method and a function - I think the discussion was 
about numpy.var  and it's "axis" argument.
I would be a clear +1  on unifying these and have a clean design of 
numpy. Consequently the old way of different defaults should be absorbed 
by the oldnumeric sub module.

All I'm saying then is that this could cause confusion later on - and 
therefore the whole idea of "easy backwards compatibility" should be 
qualified by encouraging people to adopt the most problematic changes 
(like new default values) rather sooner than later.

I'm hoping that numpy will find soon an increasingly broader acceptance 
in the whole Python community (and the entire scientific community for 
that matter ;-) ).

Thanks for all your work,
Sebastian Haase

More information about the Numpy-discussion mailing list