<p><br>
On Aug 27, 2013 12:07 AM, "Sébastien Volle" <<a href="mailto:sebastien.volle@gmail.com">sebastien.volle@gmail.com</a>> wrote:<br>
><br>
> List comprehension works too:<br>
><br>
> my_list = [ thing for thing in my_list if thing not in things ]<br>
><br>
> But both our solutions don't change my_list in place but require creating a new list, and would not be very practical with big lists.<br>
Your solution will also be slow on large lists.<br>
Since removing an item is o(n)<br>
I would pick a better container or mark items as None instead of removing them<br>
><br>
> Anyway, I'd rather stick with the simple for loop than making list methods too clever.<br>
><br>
> -- seb<br>
><br>
> Le 26 août 2013 19:56, <<a href="mailto:random832@fastmail.us">random832@fastmail.us</a>> a écrit :<br>
><br>
>> On Mon, Aug 26, 2013, at 13:11, Ram Rachum wrote:<br>
>> > my_list.remove(*things, silent_fail=True)<br>
>> ><br>
>> ><br>
>> > Aside from being much more concise, it could be more efficient too,<br>
>> > couldn't it?<br>
>><br>
>> my_list = list(filter(lambda x: x in things, my_list))<br>
>> _______________________________________________<br>
>> Python-ideas mailing list<br>
>> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
>> <a href="http://mail.python.org/mailman/listinfo/python-ideas">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
><br>
><br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/python-ideas">http://mail.python.org/mailman/listinfo/python-ideas</a></p>
<p>Cheeres <br>
</p>