D
Dale Strickland-Clark
While debugging with PDB earlier, I discovered this idiosyncracy:
(Pdb) lstValues
[[Decimal("1"), Decimal("47.0")]]
(Pdb) agg
[0, 1]
(Pdb) print list([sum(v for i in range(len(agg))) for v in lstValues])
*** NameError: global name 'v' is not defined
(Pdb)
However, the Python interpreter is happy with it if entered directly:
There seems to be some sort of scope problem in PDB.
(Pdb) lstValues
[[Decimal("1"), Decimal("47.0")]]
(Pdb) agg
[0, 1]
(Pdb) print list([sum(v for i in range(len(agg))) for v in lstValues])
*** NameError: global name 'v' is not defined
(Pdb)
However, the Python interpreter is happy with it if entered directly:
lstValues [[Decimal("1"), Decimal("47.0")]]
agg = [0,1]
print list([sum(v for i in range(len(agg))) for v in lstValues]) [Decimal("48.0")]
There seems to be some sort of scope problem in PDB.