String concatenation

Erik Max Francis max at alcyone.com
Fri Apr 2 04:05:25 EST 2004


"Leif B. Kristensen" wrote:

> And here's what the interpreter says:
> 
>     tmp=[x for x in res if x and x[0] != '-']
>           ^
> SyntaxError: invalid syntax
> 
> The marker has moved to the right, maybe because I removed the spaces
> on
> both sides of the = sign?

At this point I don't know what's going on since there's a communication
problem; Python's exception specification is based on the code you
entered, not the code it thought you meant, so you're having a
cutting-and-pasting problem at least on one side here.

If indentation is not to blame, it's possible that the problem is that
you're not running a version of Python that understands list
comprehensions.

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ They love too much that die for love.
    -- (an English proverb)



More information about the Python-list mailing list