why cannot assign to function call
Erik Max Francis
max at alcyone.com
Mon Dec 29 07:56:27 CET 2008
> I have a function return a reference, and want to assign to the
> reference, simply like this:
> >>def f(a)
> return a
> b = 0
> * f( b ) = 1*
> but the last line will be refused as "can't assign to function call".
> In my thought , the assignment is very nature, but why the interpreter
> refused to do that ?
Because, as in most languages, it's not even clear what you might mean
by this syntax. It doesn't have any meaning; assignments are made to
variables, not the results of function calls.
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
Only love is worth the risk
-- Oleta Adams
More information about the Python-list