Sub-classing NumArray - two questions
numarray is a package which is under development and intended to replace
Numeric, an efficient and operational package.
One of the classes in numarray is NumArray. As currently implemented,
instances of this class are instantiated using factory functions. This
appears to restrict the sub-classing of NumArray
Examples: a sub-class Matrix, an array restricted to two dimensions, or
a sub-class Mix, which combines the NumArray with RecArray (another
class in the numarray package), or even a sub-class of matrix, Symmetric
(to use more efficient storage)
These cannot readily be built using factory functions. This has been
discussed on the NumPy list
(http://lists.sourceforge.net/lists/l...mpy-discussion) and the
question was posed:
Can someone please explain what the "new-classes standard" is?
(Obviously meeting it is not one of our current goals)
Another related question:
It seems that certain flaws were perceived in Numeric (NumPy),
developed in 1997 by Jim Hugunin. Development of numarray was
started to produce an array package which could become a standard
Python package. What were the flaws seen in Numeric?
Background from the NumPY list:
Regarding the "new-classes standard", I can't find much in either the
Python docs or Alex Martelli's "Python in a Nutshell". One of the new
features is a __new__ constructor.
The Python array module doesn't formally have a class and thus it can't
be sub-classed. It uses a factory function to create instance objects.
Martelli, in PIAN p74, writes of factory functions being useful when one
wishes to create instances of different classes depending on some
condition or for the reuse of an existing instance.
In the Python Cookbook p173, he proposes the use of a factory function
to get around the limitations of Python 2.1 and earlier. On page 179,
he refers to the use of a factory method, again to work around
limitations before Python 2.2.
My rough and ready definition would include the ability to create an
instance and initialize
the data in one step.
|All times are GMT. The time now is 12:12 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.