I personally think that there is a better case for an ignore_case flag – the number of times that I have been caught out with [‘a.doc’, ‘b.Doc’, ‘c.DOC’] especially on MS platforms.
Steve Barnes From: Kyle Stanley <[email protected]> Sent: 23 March 2020 05:49 To: Stephen J. Turnbull <[email protected]> Cc: python-ideas <[email protected]> Subject: [Python-ideas] Re: New explicit methods to trim strings Stephen J. Turnbull wrote: > The only cases I can remember are files named things like > "thesis.doc.doc" in GUI environments. ;-) For edge cases like that, something like `"thesis.doc.doc".removesuffix(".doc").removesuffix(".doc")` should suffice, no? It may not be the cleanest looking solution, but IMO, it's better than over-complicating the method for something that would be used rarely at best. On Mon, Mar 23, 2020 at 1:34 AM Stephen J. Turnbull <[email protected]<mailto:[email protected]>> wrote: Paul Moore writes: > I've needed to remove one prefix/suffix. I've never needed to remove > more than one. The only cases I can remember are files named things like "thesis.doc.doc" in GUI environments. ;-) _______________________________________________ Python-ideas mailing list -- [email protected]<mailto:[email protected]> To unsubscribe send an email to [email protected]<mailto:[email protected]> https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/NT3ORR6E54EW3CKJGXGCN7VJWPAG5PBX/ Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/EQLQG7G57BE3VZDRNZV7IT47IDTEFHA3/ Code of Conduct: http://python.org/psf/codeofconduct/
