pl wrote:
I have to get some list variable names at some point in my program. So
I ended up looking into globals() to get them with a small function like
this:
[...]
        var = globals().keys()
        for i in var :
                if globdict[i] == obj:
                        print i

Use 'is' instead of '=='. This will return true if the arguments are the same object:
>>> l1 = [1, 2, 3]
>>> l2 = [1, 2, 3]
>>> l1 == l2
True
>>> l1 is l2
False


Daniel
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to