On Mon, Dec 29, 2008 at 4:01 PM, scsoce <scs...@gmail.com> wrote: > 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 ?
That's exactly right. You _cannot_ assign to a function call. This is invalid in just about _all_ languages. Assignments are generally bound to a variable. >>> def f(a): ... return a ... >>> b = 0 >>> x = f(b) >>> x 0 >>> cheers James -- http://mail.python.org/mailman/listinfo/python-list