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

2013-03-18 Thread Greg Ewing
Hrvoje Niksic wrote: I am not the best person to answer because I go on to argue that this syntax is not needed in Python at all (anything it can do can be implemented with __setitem__ at no loss of clarity). I would even argue that the proxy solution is even *better* for that particular use c

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

2013-03-18 Thread Guido van Rossum
Move. This. Thread. Out. Of. Python-Dev. Now. (python-ideas is the right place.) On Mon, Mar 18, 2013 at 10:25 AM, Serhiy Storchaka wrote: > On 18.03.13 17:40, Steven D'Aprano wrote: >> >> On 19/03/13 02:01, Hrvoje Niksic wrote: >>> >>> Assigning to function calls is orthogonal to reference types

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

2013-03-18 Thread Serhiy Storchaka
On 18.03.13 17:40, Steven D'Aprano wrote: On 19/03/13 02:01, Hrvoje Niksic wrote: Assigning to function calls is orthogonal to reference types. For example, Python manages assignment to subscripts without having references just fine: val = obj[index] # val = obj.__getitem__(index) obj[ind

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

2013-03-18 Thread Hrvoje Niksic
On 03/18/2013 04:40 PM, Steven D'Aprano wrote: In analogy with that, Python could implement what looks like assignment to function call like this: val = f(arg) # val = f.__call__(arg) f(arg) = val # f.__setcall__(arg, val) That's all very well, but what would it do? It's not

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

2013-03-18 Thread Skip Montanaro
On Mon, Mar 18, 2013 at 8:50 AM, Neal Becker 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. I think this belongs on python-ideas before laun

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

2013-03-18 Thread Steven D'Aprano
On 19/03/13 02:01, Hrvoje Niksic wrote: On 03/18/2013 03:23 PM, Chris Angelico wrote: The languages that permit you to assign to a function call all have some notion of a reference type. Assigning to function calls is orthogonal to reference types. For example, Python manages assignment to s

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

2013-03-18 Thread Hrvoje Niksic
On 03/18/2013 03:23 PM, Chris Angelico wrote: The languages that permit you to assign to a function call all have some notion of a reference type. Assigning to function calls is orthogonal to reference types. For example, Python manages assignment to subscripts without having references just

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

2013-03-18 Thread Xavier Morel
On 2013-03-18, at 15:23 , Chris Angelico wrote: > On Tue, Mar 19, 2013 at 12:50 AM, Neal Becker 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 w

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

2013-03-18 Thread Chris Angelico
On Tue, Mar 19, 2013 at 12:50 AM, Neal Becker 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 fu

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

2013-03-18 Thread Steven D'Aprano
On 19/03/13 00:50, Neal Becker 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. What meaning would you give to "F(x) = 3", and why? -- Steven

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

2013-03-18 Thread Joao S. O. Bueno
On 18 March 2013 10:50, Neal Becker 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. What? I mean...what are you even talking about? Assignmen

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

2013-03-18 Thread Neal Becker
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. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mail