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 <aeros...@gmail.com>
Sent: 23 March 2020 05:49
To: Stephen J. Turnbull <turnbull.stephen...@u.tsukuba.ac.jp>
Cc: python-ideas <python-ideas@python.org>
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 
<turnbull.stephen...@u.tsukuba.ac.jp<mailto:turnbull.stephen...@u.tsukuba.ac.jp>>
 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 -- 
python-ideas@python.org<mailto:python-ideas@python.org>
To unsubscribe send an email to 
python-ideas-le...@python.org<mailto:python-ideas-le...@python.org>
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/NT3ORR6E54EW3CKJGXGCN7VJWPAG5PBX/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/EQLQG7G57BE3VZDRNZV7IT47IDTEFHA3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to