[EMAIL PROTECTED] wrote:

> It's obvious for sets and dictionaries that there is only one thing to
> discard and that after the operation you're guaranteed the key no longer
> exists.  Would you want the same semantics for lists or the semantics of
> list.remove where it only removes the first instance?

In my use cases I usually know that there is either
zero or one occurrences in the list.

But maybe it would be more useful to have a remove_all()
method, whose behaviour with zero occurrences would just
be a special case.

Or maybe remove() should just do nothing if the item is
not found. I don't think I've ever found getting an exception
from it to be useful, and I've often found it a nuisance.
What experiences have others had with it?

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to