python & numpy: sum of an array slice

I have 1-dimensional numpy array (array_) and a Python list (list_).

The following code works, but is inefficient because slices involve an unnecessary copy (certainly for Python lists, and I believe also for numpy arrays?):

result = sum(array_[1:])
result = sum(list_[1:])

What's a good way to rewrite that?

9
задан max 5 May 2011 в 00:53
поделиться