VanL / shedskin

Shed Skin is an experimental compiler, that can translate pure, but implicitly statically typed Python (2.4-2.6) programs into optimized C++
0 stars 1 forks source link

improve for loop #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

l1=[1,2,3]
l2=[(4,5),(6,7)]

for i in l1:
    print(i)
for i in l2:
    print(i[0],i[1])

What is the expected output? What do you see instead?

Shedskin return:
*WARNING* petle.py: variable 'i' has dynamic (sub)type: {int, tuple2}
*WARNING* petle.py:5: expression has dynamic (sub)type: {int, tuple2}

What version of the product are you using? On what operating system?
Debian, Shedskin 0.8

Please provide any additional information below.

Variable 'i' is in 2 different loops. I suggest in this case Shedskin should 
see 2 different 'i' variables instead one.

Original issue reported on code.google.com by miros1...@gmail.com on 27 Aug 2011 at 8:47

GoogleCodeExporter commented 9 years ago
thanks! :) I agree some 'dynamic' cases such as this could actually be 
supported, but imo it's not worth the complication at this point, and it's 
usually very easy to work around the problem.. 

Original comment by mark.duf...@gmail.com on 27 Aug 2011 at 10:13