Importing variables non-deterministic?

tmellman at googlemail.com tmellman at googlemail.com
Sat Aug 17 10:25:43 EDT 2013


  I have this file that has this:

    from struct_global import y
    from struct_global import x

  and this usage (a few lines later in a class method definition in the same file):

        if y == x:

  If I stop there in pdb, I can observe this:

    (Pdb) p x
    66
    (Pdb) p y
    -1
    (Pdb) from struct_global import y
    (Pdb) p y
    62

How did my first import get hidden?  Is there any way to see where a variable resolves to?



More information about the Python-list mailing list