Message395246
numbers = [1, 2, 3, 4, 5, 6, 7, 8]
for x in numbers:
print(x)
print(x)
In the above code, print(x) statement should give error. Because x scope should be local to for loop only.
99% cases, developers will not use the temporary variable x outside of the for loop.
So x will keep on consuming memory always. So it is a bad usage of memory.
Ideally x memory should be free once for loop execution is completed. |
|
Date |
User |
Action |
Args |
2021-06-07 04:56:39 | deb_ctc | set | recipients:
+ deb_ctc |
2021-06-07 04:56:39 | deb_ctc | set | messageid: <1623041799.48.0.127398218724.issue44332@roundup.psfhosted.org> |
2021-06-07 04:56:39 | deb_ctc | link | issue44332 messages |
2021-06-07 04:56:39 | deb_ctc | create | |
|