I’ll give my personal take on this: I do see cases for “small change, small benefit”, when it makes the language more concise and doesn’t add sizable disadvantages for the users and maintainers.
With concise, I mean that you can clearly express the intent and it’s easy to write and understand.
Why a helper function may not be sufficient:
The PEP numbers state that about 15% of the most common packages use the currently available patterns. IMHO that’s common enough to justify at least considering a batteries-included solution but YMMV. OTOH, on average there are only 1.4 usages per package. I would consider it too much overhead to write a helper for 1-2 usages in my package. Likewise, I would not create an extra dependency and import for 1-2 usages.
Also, yes, mixing method and function is a bit of extra cognitive load: l.append(x); l.remove(x) is easier to follow than l.append(x); remove(l, x).
With respect to builtin types, neither user-extensibility nor third-party packages are helpful. There’s great value in a canonical set of well-designed functionality. In fact, I believe that this is one of the key success factors of Python.
Overall, I believe the imperfect current patterns are already better than a helper function. So to me the question is: a builtin solution or keep useing as is.
Can small changes be worth it?
By far not every small change is justifiable. But I strongly believe that many small improvements can add up to a significant improvement and a a net gain if the individual costs are well-considered.
PEP evaluation
I’ll go through the above discussed solutions to illustrate how such an evaluation may be done - of course judgement is subjective and you may come to other conclusions.
Need for a better solution
The PEP makes a valid point in the motivation that the current patterns have shortcomings. Concerning readability, I would say that both distract from the core operation of removing the element. In addition, the check-before-remove-pattern has extra runtime cost, and the exception pattern may catch other ValueErrors as well.
discard()
I’m still -1 on the proposed solution because discard() and remove() are semantically identical. This does not add clarity, so discard() should not be used, irrespective whether there could be an analogy to sets (which I also don’t find not a strong argument because sets are different enough so that analogies are limited; and discard should not have chosen for set in the first place either).
Other method
Even a well-named second function would be a -0 to me. It would be readable, but increases the API you have to learn. Not erroring is only a slight variation of behavior, not a completely different functionality.
Keyword argument
I would be +0.2 on an optional remove(missing_ok=True) parameter. That’s lighter than a separate function and there’s precedent for that pattern in Path.unlink. It’s not more than +0.2 because you may want to know whether something got removed, but adding a return value depending on the parameter is possibly more than we want.
ElementNotFoundError
I would be +0.5 on adding a ValueError subclass ElementNotFoundError so that one can write the exception case as:
try:
lst.remove(x)
except ElementNotFoundError:
pass
That improves readability (not as short as a oneliner, but very clear) and also removes the logic flaw that other ValueErrors might be caught.
No breaking changes
None of these solutions require deprecations or changes to existing code, which is prerequisite for the given context as the gain would not be high enough to justify changes to existing code.
Maintainer effort
I recognize that maintainer time is scarce and very valuable. For the present case, review and long-term maintainance effort are IMHO small compared to the up-front design and discussion. It’s maybe worth thinking about ways to further structure and streamline such discussions.
But unless we want to stictly limit idea input, that disuccion is necessary in one way or the other. Everybody can decide whether they want to join such conversations.