[issue8977] Globalize lonely augmented assignment

2010-06-12 Thread Mark Dickinson
Mark Dickinson added the comment: > As an aside, runtests.sh should have executable permissions. Doesn't it already? On my system (without having ever messed with any permissions as far as I can recall), I have: newton:py3k dickinsm$ ls -l runtests.sh -rwxr-xr-x 1 dickinsm staff 2168 28

[issue8977] Globalize lonely augmented assignment

2010-06-12 Thread Demur Rumed
Demur Rumed added the comment: I've modified the patch to be less aggressive, as suggested by Nick at http://mail.python.org/pipermail/python-ideas/2010-June/007428.html As an aside, runtests.sh should have executable permissions -- Added file: http://bugs.python.org/file17644/diff.2

[issue8977] Globalize lonely augmented assignment

2010-06-11 Thread Guido van Rossum
Guido van Rossum added the comment: Because the latter (n += 1) is more fundamental, since it uses integers (arguably the most fundamental type). This is why we've never done it before. -- ___ Python tracker

[issue8977] Globalize lonely augmented assignment

2010-06-11 Thread Mark Dickinson
Mark Dickinson added the comment: True. I guess there's a mismatch either way around: currently, "A += [4]" and "A.append(4)" behave differently for (e.g.,) a list A. With the proposed change, "n += 3" and "n = n + 3" behave differently for a integer n. I'm not sure why I find the latter i

[issue8977] Globalize lonely augmented assignment

2010-06-11 Thread Guido van Rossum
Guido van Rossum added the comment: It's not that much more evil than this: A = [] def f(x): A.append(x) print(A) # [] f(4) print(A) # [4] I've always thought this is a borderline case. -- nosy: +gvanrossum ___ Python tracker

[issue8977] Globalize lonely augmented assignment

2010-06-11 Thread Mark Dickinson
Mark Dickinson added the comment: This seems evil to me, when you consider the effect of this patch on immutable types: >>> A = 3 >>> def f(): ... A += 5 ... >>> f() >>> A 8 I find the possibility that a function can implicitly (i.e., without any 'global' declarations) mutate my global

[issue8977] Globalize lonely augmented assignment

2010-06-11 Thread Demur Rumed
Changes by Demur Rumed : -- type: feature request -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue8977] Globalize lonely augmented assignment

2010-06-11 Thread Demur Rumed
Demur Rumed added the comment: A note on the patch, ste->ste_tmpname... lines, along with changes to Lambda_kind, were not added by me. The additional newlines prior to symtable_visit_stmt's declaration are accidental, apologies. I'll avoid patching a snapshot and then pull the old version fr

[issue8977] Globalize lonely augmented assignment

2010-06-11 Thread Demur Rumed
New submission from Demur Rumed : A=[1,2,3] def f(x): A+=x, This throws an error. The solution: state "global a". I find it odd that augmented assignment should be viewed the same as assignment in descerning local variables. This patch repairs such to maintain a as a variable of the globa