[Numpy-discussion] Ransom Proposals

Ed Schofield schofield at ftw.at
Sun Mar 26 05:45:04 CST 2006

On 26/03/2006, at 8:34 AM, Tim Hochberg wrote:

> That brings up another question: is the plan to keep oldnumeric  
> around forever, or is it going away eventually? If it is going  
> away, then the place to put these would be oldnumeric. Actually,  
> it's OK if it sticks around as long as it doesn't end up in the  
> numpy namespace by default.

I think this is a great idea.  Let's remove the functions in  
oldnumeric.py from the numpy namespace by default.  People migrating  
from Numeric could add "from numpy.core.oldnumeric import *" at the  
top of each source file for compatibility.  This would send a clear  
message that the functions in this module are deprecated and there  
for compatibility reasons only, and that the methods are the  
preferred interface.  A clear division like this between the old and  
the new would also simplify decisions on when to leave the existing  
behaviour alone and when it should be changed for the better.  Then  
the problem Fernando sees with the reshape function and method having  
different copy / view behaviour would be easier to explain and  
understand -- the functions just do the old Numeric thing, whereas  
the methods are consistent with each other.

I'm now a fan of method interfaces in Python.  One reason is that,  
with .reshape(), .sum() etc. as methods, rather than functions, it's  
possible for me to make the behaviour of SciPy's sparse matrices  
highly consistent with NumPy's arrays and matrices, without NumPy  
needing hooks for this.  But making numpy.sum etc accept either dense  
or sparse matrices would require extensive modification to NumPy.

-- Ed

More information about the Numpy-discussion mailing list