Comparing lists ...
Loic
loic at spam.me
Tue Feb 13 19:18:00 EST 2007
I would like to know if it is possible, and how to do this with Python:
I want to design a function to compare lists and return True only if
both lists are equal considering memory location of the list.
I suppose it would be the equivalent of comparing 2 pointers in c++
lets call this function check(a, b)
and define a few lists:
>>> l0 = [1, 2, 3, 4]
>>> l1 = [1, 2, 3, 4]
>>> l2 = l0
I want it to have the following behaviour:
>>> check(l1, l0)
False
>>> check(l2, l0)
True
>>> check(l1, l2)
False
Any idea how to do this with Python?
More information about the Python-list
mailing list