Alex Martelli wrote: > Fuzzyman <[EMAIL PROTECTED]> wrote: > > > What gives ? > ... > > >>> a = [] > > >>> def f(): > > return a > ... > > >>> f() += [4] > > SyntaxError: can't assign to function call > > Exactly what the error message says: it's syntactically forbidden to > perform any assignment on a function-call. > > If you're keen on these semantics, use for example > > f().extend([4]) >
Cool, thanks. That's what I did, it's just not an error I'd seen before. Everywhere else Python evaluates the function call and then does it's stuff with the result. All the best, Fuzzyman > which IS quite legal (or, if you know the RHS list has only one item, > f().append(4) is clearer and more effective). > > > Alex -- http://mail.python.org/mailman/listinfo/python-list