On 03/16/2017 10:38 AM, Wolfgang Maier wrote:

In addition, I'd agree with Alan that the advantage of using numpy
functionality in this function seems quite questionable. You'd probably
get pretty much the same performance with just:

def sum2(N):
    return sum(2*(1+3**(i-1)) for i in range(1,N+1,1))


Or, if you really want to leverage the power of numpy (and are willing to pay the price of possibly inexact calculations) rewrite your function as Peter shows in his reply.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to