On Jul 21, 8:17 pm, John Nagle wrote:
> On 7/19/2010 9:56 AM, dhruvbird wrote:
>
> > On Jul 19, 9:12 pm, Brian Victor wrote:
> >> dhruvbird wrote:
> >> Having offered this, I don't recall ever seeing reduce used in real
> >> python code, and e
On Jul 19, 4:28 pm, Peter Otten <__pete...@web.de> wrote:
> dhruvbird wrote:
> > I have a list of integers: x = [ 0, 1, 2, 1, 1, 0, 0, 2, 3 ]
> > And would like to compute the cumulative sum of all the integers
> > from index zero into another array. So for the ar
On Jul 19, 9:12 pm, Brian Victor wrote:
> dhruvbird wrote:
> > Hello,
> > I have a list of integers: x = [ 0, 1, 2, 1, 1, 0, 0, 2, 3 ]
> > And would like to compute the cumulative sum of all the integers
> > from index zero into another array. So for the array abov
Hello,
I have a list of integers: x = [ 0, 1, 2, 1, 1, 0, 0, 2, 3 ]
And would like to compute the cumulative sum of all the integers
from index zero into another array. So for the array above, I should
get: [ 0, 1, 3, 4, 5, 5, 5, 7, 10 ]
What is the best way (or pythonic way) to get this.
Re
On Jul 12, 4:20 pm, Hrvoje Niksic wrote:
> dhruvbird writes:
> > No, I meant x.append(4)
> > Except that I want to accomplish it using slices.
>
> > (I can do it as x[lex(x):] = [item_to_append] but is there any other
> > way?)
>
> It seems that you've
On Jul 12, 5:30 am, News123 wrote:
> dhruvbird wrote:
>
> > On a side note, is there any other way to append to a list using
> > slices (apart from the one below):
> > x[len(x):len(x)] = [item to append]
>
> dy you mean
> x.extend([1,2,3])
No, I meant x.append(4)
On Jul 11, 9:19 pm, Thomas Jollans wrote:
> On 07/11/2010 05:59 PM, dhruvbird wrote:
>
> > Why doesn't python's list append() method return the list itself? For
> > that matter, even the reverse() and sort() methods?
> > I found this link (http://code.goog
Why doesn't python's list append() method return the list itself? For
that matter, even the reverse() and sort() methods?
I found this link (http://code.google.com/edu/languages/google-python-
class/lists.html) which suggests that this is done to make sure that
the programmer understands that the l