PDB scope problem

Discussion in 'Python' started by Dale Strickland-Clark, Oct 22, 2007.

  1. 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:

    >>> 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.

    --
    Dale Strickland-Clark
     
    Dale Strickland-Clark, Oct 22, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Opal
    Replies:
    12
    Views:
    1,009
    Paul Opal
    Oct 11, 2004
  2. ann
    Replies:
    13
    Views:
    698
    Patricia Shanahan
    Sep 13, 2005
  3. Steven T. Hatton
    Replies:
    9
    Views:
    522
  4. p cooper

    Palm::PDB problem

    p cooper, May 14, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    87
    p cooper
    May 14, 2005
  5. Josef Moellers

    Palm::PDB: How to compose a PDB?

    Josef Moellers, Aug 16, 2007, in forum: Perl Misc
    Replies:
    0
    Views:
    164
    Josef Moellers
    Aug 16, 2007
Loading...

Share This Page