471,350 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

PDB scope problem

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[i] 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[i] for i in range(len(agg))) for v in lstValues])
[Decimal("48.0")]
>>>
There seems to be some sort of scope problem in PDB.

--
Dale Strickland-Clark
Oct 22 '07 #1
0 766

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

33 posts views Thread by Arthur | last post: by
4 posts views Thread by Marc Tanner | last post: by
4 posts views Thread by Gery D. Dorazio | last post: by
165 posts views Thread by Dieter | last post: by
6 posts views Thread by Frank Silvermann | last post: by
78 posts views Thread by Josiah Manson | last post: by
3 posts views Thread by Pantokrator | last post: by
7 posts views Thread by David Mathog | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.