
Thanks for the pointers to emails. Ethan Furman: "This is why replace() still only takes a single substring to match and this isn't supported: (...)" Hum ok, it makes sense. I agree that we can start with only accepting str (reject tuple), and maybe reconsider the idea of accepting a tuple of str later. Please move the idea in Rejected Ideas, but try also to summarize the reasons why the idea was rejected. I saw: * surprising result for empty prefix/suffix * surprising result for "FooBar text".cutprefix(("Foo", "FooBar")) * issue with unordered sequence like set: only accept tuple which is ordered * str.replace() only accepts str.replace(str, str) to avoid these issues: the idea of accepting str.replace(tuple of str, str) or variant was rejected multiple times. XXX does someone have references to past discussions? I found https://bugs.python.org/issue33647 which is a little bit different. You may mention re.sub() as an existing efficient solution for the complex cases. I have to confess that I had to think twice when I wrote my example line.cutsuffix(("\r\n", "\r", "\n")). Did I write suffixes in the correct order to get what I expect? :-) "\r\n" starts with "\r". Victor Le mer. 25 mars 2020 à 01:44, Dennis Sweeney <sweeney.dennis650@gmail.com> a écrit :
There were at least two comments suggesting keeping it to one affix at a time:
https://mail.python.org/archives/list/python-dev@python.org/message/GPXSIDLK...
https://mail.python.org/archives/list/python-dev@python.org/message/EDWFPEGQ...
But I didn't see any big objections to the rest of the PEP, so I think maybe we keep it restricted for now. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@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/QBCB2QMU... Code of Conduct: http://python.org/psf/codeofconduct/
-- Night gathers, and now my watch begins. It shall not end until my death.