kgashok / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

Iteration var can't be reused if type changed #144

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It's better to intelligently identify and rename the index var in loop. e.g. 
add prefix to the name using loop id 

Test case:

a=[1,2,3]
b=['ab','cd']
for i in a:
    print i
for i in b:
    print i

Output:
[analyzing types..]
********************************100%
[generating c++ code..]
*WARNING* test_var.py: variable 'i' has dynamic (sub)type: {str, int}
*WARNING* test_var.py:5: expression has dynamic (sub)type: {str, int}
*WARNING* test_var.py:7: expression has dynamic (sub)type: {str, int}

Original issue reported on code.google.com by jason.mi...@gmail.com on 13 Jul 2011 at 2:41

GoogleCodeExporter commented 8 years ago
thanks for the suggestion :) I agree that at some point this could be a good 
thing to work on. it just doesn't have priority at the moment, since it's easy 
to work around and other things are more important.. 

Original comment by mark.duf...@gmail.com on 13 Jul 2011 at 7:26