[Python-Dev] SyntaxError: can't assign to function call (original) (raw)
Phillip J. Eby pje at telecommunity.com
Thu Aug 10 22:57:44 CEST 2006
- Previous message: [Python-Dev] SyntaxError: can't assign to function call
- Next message: [Python-Dev] SyntaxError: can't assign to function call
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 12:28 PM 8/10/2006 -0700, Guido van Rossum wrote:
On Aug 10, 2006, at 12:31 PM, Phillip J. Eby wrote: > 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. I assume this was meant tongue-in-cheek.
Not entirely, no.
I see no reason to get rid of +=. The opportunity for hypergeneralization (== ill-advised generalization based on the misunderstanding of some mechanism) does not automatically mean a mechanism should not be added (although it can sometimes be a warning sign).
I think it's a warning sign because I know what augmented assignment's semantics are supposed to be and I still try to use it with setdefault() sometimes -- but only when I'm doing an augmented assignment. I never mistakenly try to assign to a function call in any other circumstance.
However, I'm also not clear that trying to assign to a function call is ill-advised. One of the things that attracted me to Python in the first place is that it had a lot of features that would be considered "hypergeneralization" in other languages, e.g. the ability to create your own sequences, mappings, and callable objects in the first place.
That being said, the benefit of hypergeneralizing assignment seems small compared to its price. So eliminating augmented assignment seems a more attractive way to get rid of the nuisance of the perennially repeated proposals to "fix" or otherwise extend it. Sometimes it seems like half the time I want to use augmented assignment, I can't use it anyway for one reason or another, so it doesn't seem like that big of a loss.
- Previous message: [Python-Dev] SyntaxError: can't assign to function call
- Next message: [Python-Dev] SyntaxError: can't assign to function call
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]