At 09:24 AM 8/10/2006 -0700, Guido van Rossum wrote: >On 8/10/06, James Y Knight <[EMAIL PROTECTED]> wrote: > > It makes just as much sense as assigning to an array access, and the > > semantics would be pretty similar. > >No. Array references (x[i]) and attribute references (x.a) represent >"locations". Function calls represent values. This is no different >than the distinction between lvalues and rvalues in C.
IIRC, in Lisp a function call can be an lvalue. OTOH, that's probably because in Lisp there isn't anything besides function calls. :) I'm having a hard time imagining a use case in Python, though, except to allow things like "somedict.setdefault(key,0) += 1". And I'm not sure that's an improvement, although there have certainly been times that I started to write that, and then grumbled and wrote "somedict[key] = somedict.setdefault(key,0) + 1" instead. Honestly, it might make more sense to get rid of augmented assignment in Py3K rather than to add this. It seems that the need for something like this springs primarily from the existence of augmented assignment. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com