[Numpy-discussion] Extensive use of methods instead of functions

José Fonseca j_r_fonseca at yahoo.co.uk
Fri Jan 24 14:00:03 CST 2003


On Fri, Jan 24, 2003 at 09:07:21PM +0100, Konrad Hinsen wrote:
> José Fonseca <j_r_fonseca at yahoo.co.uk> writes:
> 
> > With the ability of subclassing types in recent versions of the Python
> > language, more people will be interested in subclassing Numeric arrays
> > for specific purposes.  Still the use of functions instead of methods
> > takes away many of the advantages, the ability of being overloaded.
> 
> True. On the other hand, there is also an advantage: NumPy routines
> can be used on standard Python data types such as number and sequence
> types.
> 
> In the ideal world (which might come one day), core NumPy
> functionality would be part of standard Python, and then all these
> operations would work on other built-in types as well.
> 
> Until then, I am not sure that changing NumPy functions to methods
> is a good idea. I need to call them on scalar numbers much more
> often than I subclass arrays.

You've got a good point there. I often want to use with other Numeric
array-alike classes, but I've also used them with standard Python data
types for convenience. 

Still, it's perfectly possible to both interfaces to co-exist. Of course
that when one would use the .method version it can't expect to work with
standard Python data types and has to make a choice, or to use asarray()
or something equivalent before using it.

Regards,

José Fonseca
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com




More information about the Numpy-discussion mailing list