On 8/23/06, Bill Baxter <[EMAIL PROTECTED]> wrote:
> The thing that I find I keep forgetting is that abs() is a built-in, but
> other simple functions are not.  So it's abs(foo), but numpy.floor(foo) and
> numpy.ceil(foo).  And then there's round() which is a built-in but can't be
> used with arrays, so numpy.round_(foo).    Seems like it would be more
> consistent to just add a numpy.abs() and numpy.round().
>
> But I guess there's nothing numpy can do about it...  you can't name a
> method the same as a built-in function, right?  That's why we have
> numpy.round_() instead of numpy.round(), no?
> [...goes and checks]
> Oh, you *can* name a module function the same as a built-in.  Hmm... so then
> why isn't numpy.round_() just numpy.round()?  Is it just so "from numpy
> import *" won't hide the built-in?

Technically numpy could simply have (illustrated with round, but works
also with abs)

round = round_

and simply NOT include round in the __all__ list.  This would make

numpy.round(x)

work (clean syntax) while

from numpy import *

would not clobber the builtin round.  That sounds like a decent solution to me.

Cheers,

f

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to