> On 2018 Jun 13 , at 4:43 p, Michel Desmoulin <desmoulinmic...@gmail.com> > wrote: > > > > Le 13/06/2018 à 19:11, Mike Miller a écrit : >> >> On 2018-06-13 06:33, Michel Desmoulin wrote: >>> >>> I often wished for findall and sub to be string methods, so +1 on that. >>> >> >> Agreed, and there are a few string functions that could be extended (to >> take a sequence) to handle more cases that push folks to regex, perhaps >> earlier than they should. > > str.replace come to mind. It's a annoying to have to chain it 5 times > while we could pass optionally a tuple. > > several startswith() and endswith() require a loop, but we could make > them accept *args.
Both accept a tuple. For example: >>> "foo".startswith(("f", "b")) True >>> "bar".startswith(("f", "b")) True > > Also, we do have to saturate the str namespace with all the re > functions. We could decide to go for `str.re.stuff`. Attaching an entire module to a type is probably worse than adding a slew of extra methods to the type. -- Clint _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/