Fuzzyman <[EMAIL PROTECTED]> wrote: ... > > Exactly what the error message says: it's syntactically forbidden to > > perform any assignment on a function-call. ... > 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.
Not sure what you mean by 'everywhere else'; generally and syntactically speaking, you can use a function-call, more or less, in all the places, and only the places, in which you could use a constant (literal) list such as [2] -- you can't assign to it, you can't use it as the x in 'for x in ...', in a clause "except x, y:" you can (syntactically) use it as x but not as y, etc. Basically, wherever Python needs a rebindable name or other rebindable reference, you cannot substitute a function call, nor a constant (literal) list (nor any of several other possible literals and other expressionforms). Wherever Python just needs a value, not a rebindable whatever, then of course you can supply that value in whatever syntax form suits you best, including a function-call, a literal, and many other ways besides. Alex -- http://mail.python.org/mailman/listinfo/python-list