have a look at the following piece of code, which shows a list comprehension..
>>> i = 6
>>> s = [i * i for i in range(100)]
>>> print(i)
When you execute the code example in Python 2.6 it prints 99, but when you execute it in Python 3.x it prints 6.
What were the reason for changing the behaviour and why is the output 6 in Python 3.x?
Thank you in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…