Thanks for the feedback!

I meant mnemonic as in the broader sense of "way of remembering things", not 
some kind of rhyming device or acronym. Maybe "mnemonic" isn't the perfect 
word. I was just trying to say that the structure of how the methods are named 
should how their behavior relates to one another, which it seems you agree with.

Fair enough that ``[l/r]strip`` and the proposed methods share the behavior of 
"removing something from the end of a string". From that perspective, they're 
similar. But my thought was that ``s.lstrip("abc")`` has extremely similar 
behavior when changing "lstrip" to "rstrip" or "strip" -- the argument is 
interpreted in the exactly same way (as a character set) in each case. Looking 
at how the argument is used, I'd argue that ``lstrip``/``rstrip``/``strip`` are 
much more similar to each other than they are to the proposed methods, and that 
the proposed methods are perhaps more similar to something like 
``str.replace``. But it does seem pretty subjective what the threshold is for 
behavior similar enough to have related names -- I see where you're coming from.

Also, the docs at ( 
https://docs.python.org/3/library/stdtypes.html?highlight=lstrip#string-methods 
) are alphabetical, not grouped by "similar names", so even ``lstrip``, 
``strip``, and ``rstrip`` are already in different places. Maybe the name 
"stripprefix" would be more discoverable when "Ctrl-f"ing the docs, if it 
weren't for the following addition in the linked PR:

     .. method:: str.lstrip([chars])

        Return a copy of the string with leading characters removed.  The 
*chars*
        argument is a string specifying the set of characters to be removed.  
If  omitted
        or ``None``, the *chars* argument defaults to removing whitespace.  The 
*chars*
        argument is not a prefix; rather, all combinations of its values are 
stripped::

           >>> '   spacious   '.lstrip()
           'spacious   '
           >>> 'www.example.com'.lstrip('cmowz.')
           'example.com'

    +  See :meth:`str.cutprefix` for a method that will remove a single prefix
    +  string rather than all of a set of characters.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/55QJHR6PP4IWFLBRTFL4TZX5QOBJQFO5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to