While namespaces are a really good idea, I'm not a big fan of both "module" 
namespaces and underscore namespaces.   It seems pretty redundant to me to have 
pad.pad_mean. 

On the other hand, one could argue that pad.mean could be confused with 
calculating the mean of a padded array.   So, it seems like the function names 
need to be called something more than just "mean, median, etc."   Something 
like padwith_mean, padwith_median, etc. actually makes more sense.   Or 
pad.with_mean, pad.with_median.   The with_ in this case is not really a 
"namespace" it's an indication of functionality. 

With that said, NumPy was designed not to be "deep" in terms of naming.    We 
should work hard to ensure that functions and Classes to be instantiated by the 
user are no more than 2 levels down (i.e. either in the NumPy namespace or in 
the numpy.<subpackage> namespace. 

So, either we need to move pad into a new subpackage and call things 

pad.with_mean
pad.with_median
etc.

or keep the functions

pad_mean,
pad_median,

etc.

in numpy.lib

I don't think this functionality really justifies an entire new sub-package in 
NumPy, though.  So, I would vote for keeping things accessible as

numpy.lib.pad_mean


-Travis
 






1) The functions in pad.py be imported into the lib namespace
2) The functions all be renamed to padwith_mean

On Mar 29, 2012, at 9:55 AM, Tim Cera wrote:

> 
> On Wed, Mar 28, 2012 at 6:08 PM, Charles R Harris <charlesr.har...@gmail.com> 
> wrote:
> 
> I think there is also a question of using a prefix pad_xxx for the function 
> names as opposed to pad.xxx.
> 
> If I had it as pad.mean, pad.median, ...etc. then someone could
> 
>     from numpy.pad import *
>     a = np.arange(5)
>     # then you would have a confusing
>     b = mean(a, 2)
> 
> Because of that I would vote for 'pad.pad_xxx' instead of 'pad.xxx'.  In fact 
> at one time I named the functions 'pad.pad_with_xxx' which was a little 
> overkill.
> 
> Kindest regards,
> Tim
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to