[pypy-dev] micronumpy 'fromnumeric' patch
coolbutuseless at gmail.com
Wed Jan 4 22:02:58 CET 2012
Numpy is somewhat derived from another array library called 'Numeric'.
What were originally functions in 'Numeric' have been promoted to ndarray
methods in numpy. The implementation of this code in numpy is in *
numpy/core/fromnumeric.py*. The list of functions that were promoted is
listed at the end of this email.
However, these functions must be retained for compatibility, but all they
should do is call the ndarray method.
e.g. "numpy.ravel(a)" is just a wrapper which returns "a.ravel()"
* copied all docstrings from numpy1.6 numpy/core/fromnumeric.py into
* for methods which we currently have (e.g. max, argmax), I have
* made the function just call the relavant method and return the value
* written a test_fromnumeric_* using the docstring examples
* for methods which we don't have I have raised a NotImplemented Error
I realise that this is a lot of boring boilerplate code & docstrings, but I
think it's to everyone's advantage to flesh out the micronumpy
implementation a bit more so that we can see what has/hasn't been done.
This will also be useful to newcomers - like me - who can now find obvious
functions that need implementation.
Could someone please review, fix if necessary and commit.
# __all__ = ['take', 'reshape', 'choose', 'repeat', 'put',
# 'swapaxes', 'transpose', 'sort', 'argsort', 'argmax', 'argmin',
# 'searchsorted', 'alen',
# 'resize', 'diagonal', 'trace', 'ravel', 'nonzero', 'shape',
# 'compress', 'clip', 'sum', 'product', 'prod', 'sometrue',
# 'any', 'all', 'cumsum', 'cumproduct', 'cumprod', 'ptp', 'ndim',
# 'rank', 'size', 'around', 'round_', 'mean', 'std', 'var',
# 'amax', 'amin',
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pypy-dev