Are there any list comparison optimizations in Python?
jbperez808 at yahoo.com
Tue Nov 13 01:36:32 CET 2001
>>> xlist.remove(x) # these 2 statements not executed one after
>>> xlist.remove(y) # the other but representing different cases
One of Python's most convenient high-level features is automatic list
comparison by value and recursively.
Does it know to optimize the compare if it has already been determined
that two items share a reference to the same object by not doing a
value compare on them anymore?
And will this apply to both the comparison and remove() calls above?
More information about the Python-list