[docs] List tutorial

Matthew Gilson mlr54 at cisunix.unh.edu
Fri May 6 02:58:36 CEST 2011


at:
http://docs.python.org/release/2.6/tutorial/datastructures.html#more-on-lists
Perhaps this is nit-picky, but ...
The documentation says that list.remove(x) removes the first item whose 
value is x.  In reality, that method removes the first item whose value 
equals x.

simple example:
class test(object):
    def __eq__(self,other):
       return True

l=[test(),test()]
l.remove(True)
l.remove(True)
print l # [] <<< Empty list.  test class instances were removed because 
they equal True, not because they are True!

Perhaps that is what is meant by whose "value" is x, but I think the 
wording there is a little ambiguous.




More information about the docs mailing list