On Mon, Apr 1, 2019 at 11:00 AM Steven D'Aprano <steve@pearwood.info> wrote:
On Mon, Apr 01, 2019 at 12:02:25PM +1300, Greg Ewing wrote:
Dan Sommers wrote:
without_prefix without_suffix
They're a little longer, but IMO "without" helps reenforce the immutability of the underlying string.
We don't seem to worry about that distinction for other string methods, such as lstrip and rstrip.
Perhaps we ought to. In the spirit of today's date, let me propose renaming existing string methods to be more explicit, e.g.:
str.new_string_in_uppercase str.new_string_with_substrings_replaced str.new_string_filled_to_the_given_length_with_zeroes_on_the_left str.new_string_with_character_translations_not_natural_language_translations
Excellent! Love it. Add that to the feature list for Python 2.8. But for those of us still discussing the 3.x line, do we need to put together a PEP about this? There seems to be a lot of bikeshedding, a lot of broad support, and a small amount of "bah, don't need it, use regex/long expression/etc". Who wants to champion the proposal? Do we have a core dev who's interested in sponsoring it? ChrisA