[docs] List tutorial

Georg Brandl georg at python.org
Tue May 10 09:05:12 CEST 2011


On 09.05.2011 15:00, Eli Bendersky wrote:
> 
> 
> On Fri, May 6, 2011 at 03:58, Matthew Gilson <mlr54 at cisunix.unh.edu
> <mailto:mlr54 at cisunix.unh.edu>> wrote:
> 
>     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.
> 
> 
> I agree it's nit-picky :-)
> 
> At the tutorial level, "value is x" is good enough for the readers. Twisting the
> tongue to avoid confusion between "is" and "equals" is IMHO unnecessary.
> 
> So -1 from me.

If the sentence was "... the first item that is x", I would object (since it
implies object identity comparison).  As it is right now, the "value of the
item" isn't really a well-defined Python term anyway, so whether you say "the
value is x" or "the value equals x" doesn't make a difference.
But it serves the purpose well in the tutorial, so I'd just keep it.

Georg


More information about the docs mailing list