1 Apr
2009
1 Apr
'09
6:15 a.m.
So. The issue was closed and I suppose it was closed by not entirely understanding the problem (or I didn't get it completely). The question is - what the following code should do? def f(): a = 2 class C: exec 'a = 42' abc = a return C print f().abc (quick answer - on python2.5 it return 42, on python 2.6 and up it returns 2, the patch changes it to syntax error). I would say that returning 2 is the less obvious thing to do. The reason why IMO this should be a syntax error is this code: def f(): a = 2 def g(): exec 'a = 42' abc = a which throws syntax error. Cheers, fijal
5466
Age (days ago)
5476
Last active (days ago)
21 comments
9 participants
participants (9)
-
"Martin v. Löwis"
-
Alexandre Vassalotti
-
Benjamin Peterson
-
Chris Withers
-
Guido van Rossum
-
Jeremy Hylton
-
Maciej Fijalkowski
-
R. David Murray
-
Steve Holden