Greg Ewing wrote: > Actually I'd like this for lists. Often I find myself > writing > > if x not in somelist: > somelist.remove(x) > > A single method for doing this would be handy, and > more efficient.
there is a single method that does this, of course, but you have to sprinkle some sugar on it: try: somelist.remove(x) except ValueError: pass </F> _______________________________________________ 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