[Python-Dev] SyntaxError: can't assign to function call

"Martin v. Löwis" martin at v.loewis.de
Fri Aug 11 22:10:20 CEST 2006


Phillip J. Eby schrieb:
> Actually, this isn't as hard as you're implying.  In at least the
> "compiler.ast" package, such an operation would be represented as a
> CallFunc node as the child of an Assign node.  Wrapping the call node's
> main child expression in a Getattr for __setcall__ would then effect the
> relatively simple AST transformation required.

Well, you are experienced with that stuff, and would be one of the
people who could rip apart a specification attempt. There are just many
details to it, for example, what is the evaluation order when I write

f(g()) = h()

Or what about chained assignments

a = b() = c()

Is the return value of __setcall__ used or not?

What about augmented assignments?

Any specific question that somebody asks gets an easy (although
perhaps arbitrary) answer. Still, I guess many people would be
surprised how large the specification of a seemingly simple feature
will be.

Regards,
Martin


More information about the Python-Dev mailing list