473,289 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 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 815

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Arthur | last post by:
>>>a= >>> for p in a: print p 1 2 3 >>> p 3 My naive expectation was that p would be 'not defined' from outside
4
by: Marc Tanner | last post by:
Hello, I am currently working on a eventhandling system or something similar, and have the problem of loosing scope. I have read many interesting posts on this group and the faq article about...
4
by: Gery D. Dorazio | last post by:
Gurus, If a static variable is defined in a class what is the scope of the variable resolved to for it to remain 'static'? For instance, lets say I create a class library assembly that is...
165
by: Dieter | last post by:
Hi. In the snippet of code below, I'm trying to understand why when the struct dirent ** namelist is declared with "file" scope, I don't have a problem freeing the allocated memory. But...
6
by: Frank Silvermann | last post by:
I have taken an extraordinary leap into the modern world by purchasing webspace. In addition to my private concerns, I would like to make a part to which others, e.g. my nieces and ex-wife, can...
78
by: Josiah Manson | last post by:
I found that I was repeating the same couple of lines over and over in a function and decided to split those lines into a nested function after copying one too many minor changes all over. The only...
7
by: Frank | last post by:
Hi, I have the following problem with dynamic memory: int main(){ for(){ int (**w)=new int *; for(m = 0; m < N1; m++) {
3
by: Pantokrator | last post by:
Hi all, I've got a question about the scope of the constructor initialisation list. First of all, let me explain my classes: // ***************************************************** class...
7
by: David Mathog | last post by:
I accidentally did this the other day (it was a lot less obvious in the much longer actual program, hundreds of lines are omitted): ----------------------------------------------------------...
5
by: somenath | last post by:
Hi All , I have one question regarding scope and lifetime of variable. #include <stdio.h> int main(int argc, char *argv) { int *intp = NULL; char *sptr = NULL;
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.