title: Access prior element in a list comprehension
body: <p>I've looked around into list comprehensions on here, and can find a solution for this.</p>
  
  <p>Closest I've come is questions that advice using <a href="http://docs.python.org/2/library/functions.html#enumerate" rel="nofollow noreferrer"><code>enumerate()</code></a> while iterating in a list comprehension.</p>
  
  <p>What I'd like to do is access the prior element in a list comprehension. <a href="https://codegolf.stackexchange.com/questions/18960/expand-tabs-implement-expand1">The context is this question on another StackExchange site</a>.</p>
  
  <p>Basically, if I get this string from <code>stdin</code> - <code>4,6,+2,+8</code>, I'd like to output the array that is the integer of the number, or the number plus the value of the prior element. In the given case the final array is: <code>4,6,8,16</code> - or <code>4,6,6+2,(6+2)+8</code>. Going from left to right with an array and for loop its trivial to generate, but I'm curious to know if it can be done in a single list comprehension.</p>
  
  <p>As for what I have:</p>
  
  <pre><code>from sys import*
  s=argv[1].split(',')
  for i in range(len(s)):
   s[i]=eval(`s[i-1]`*(s[i][0]=='+')+s[i])
  print s
  </code></pre>
  
  <p>Which prints the correct result, however the following list comprehension does not:</p>
  
  <pre><code>s=argv[1].split(',')
  s=[eval(s[i-1]*(x[0]=='+')+x) for i,x in enumerate(s)]
  print s
  </code></pre>
  
  <p>Which results in:</p>
  
  <pre><code>[4, 6, 8, 10]
  </code></pre>
  
  <p>Which is equivilient to <code>4, 6, +2+6, +2+8</code>.</p>
  
  <p>What I'd like to be able to do finally is something along the lines of:</p>
  
  <pre><code>s=[eval(PRIOR_VALUE*(x[0]=='+')+x) for x in argv[1].split(',')]
  </code></pre>
  
  <p>So can I easily access the prior computed element of a list comprehension in the same list comprehension?</p>