Comparing lists ...

Paul Rubin http
Tue Feb 13 19:20:58 EST 2007


Loic <loic at spam.me> writes:
> 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++

Use the "is" keyword.

  print (l1 is l2)
  print (l0 is l2)



More information about the Python-list mailing list