removeall() in list

castironpi at gmail.com castironpi at gmail.com
Fri Jan 11 17:29:32 EST 2008


On Jan 11, 2:57 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> castiro... at gmail.com writes:
> > Any ideas for a thread-safe list.removeall( X ): removing all
> > occurrences of X within list L, when L might be modified concurrently?
>
> That way lies madness.  Do something sensible instead.  Put a lock
> around the list, or put all mutators for the list into a single
> thread, or whatever.  Don't do what you're describing.

This function just wants X out of the list.  It doesn't matter if this
happens before, during, or after something else; so long as it happens.



More information about the Python-list mailing list