[Python-Dev] can't assign to function call (original) (raw)

Xavier Morel python-dev at masklinn.net
Mon Mar 18 15:44:44 CET 2013


On 2013-03-18, at 15:23 , Chris Angelico wrote:

On Tue, Mar 19, 2013 at 12:50 AM, Neal Becker <ndbecker2 at gmail.com> wrote:

def F(x): return x

x = 2 F(x) = 3 F(x) = 3 SyntaxError: can't assign to function call Do we really need this restriction? There do exist other languages without it. The languages that permit you to assign to a function call all have some notion of a reference type.

Alternatively they're functional language defining "match cases" e.g. in Haskell a function is defined as

foo a b c = someOperation a b c

which is functionally equivalent to Python's

def foo(a, b, c):
    return someOperation(a, b, c)


More information about the Python-Dev mailing list