A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-September/068934.html below:

[Python-Dev] list.discard? (Re: dict.discard)

[Python-Dev] list.discard? (Re: dict.discard) [Python-Dev] list.discard? (Re: dict.discard)Fredrik Lundh fredrik at pythonware.com
Fri Sep 22 10:35:50 CEST 2006
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> 



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4