[Python-ideas] Proposal how to remove all occurrences of a value from a Python list
Mark Lawrence
breamoreboy at yahoo.co.uk
Sat Oct 10 22:11:55 CEST 2015
On 04/10/2015 00:14, Rob Cliffe wrote:
>
> Other things that might be useful (sorry, I have no use cases in mind):
> a.remove(1, count) # maximum number of removals, analogous to
> aString.replace(old, new, count)
Make the default count=1 to preserve the current behaviour and wouldn't
everybody be happy?
> a remove-like function that does not raise an error if the item is
> not present
> a remove-like function that returns the mutated list (like
> sorted(), as opposed to list.sort() )
> It's not obvious to me how to design good API(s) to do some/all of this.
> Rob Cliffe
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Python-ideas
mailing list