speed of numpy.power()?

David Cournapeau cournape at gmail.com
Wed Aug 25 11:40:10 EDT 2010


On Wed, Aug 25, 2010 at 10:59 PM, Carlos Grohmann
<carlos.grohmann at gmail.com> wrote:
> Hi all,
>
> I'd like to hear from you on the benefits of using numpy.power(x,y)
> over (x*x*x*x..)

Without more context, I would say None if  x*x*x*x*... works and you
are not already using numpy. The point of numpy  is mostly to work on
numpy arrays, and to support types of data not "natively" supported by
python (single, extended precision). If x is a python object such as
int or float, numpy will also be much slower. Using numpy would make
sense if for example you are already using numpy everywhere else, for
consistency reason,

David



More information about the Python-list mailing list