
On 13.10.2021 20:47, Paul Moore wrote:
On Wed, 13 Oct 2021 at 19:02, <2QdxY4RzWzUUiLuE@potatochowder.com> wrote:
So aside from filename extensions, what are the real use cases for suffix removal? Plurals? No, too locale-dependent and too many exceptions. Whitespace left over from external data? No, there's already other functions for that (and regexen and actual parsers if they're not good enough). Directory traversal? No, that's what path instances and the os module are for.
I think this is a good point. Is removesuffix really useful enough to warrant having an operator *as well as* a string method? It was only added in 3.9, so we've been managing without it at all for years, after all...
Sure, but that's not evidence that this kind of operation is not common. Some examples: - removal of file extensions - removal of end tags - removal of units - removal of currencies - removal of standard suffixes - removal of wildcard patterns etc. I find lots of such uses in the code bases I work with. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Oct 13 2021)
Python Projects, Coaching and Support ... https://www.egenix.com/ Python Product Development ... https://consulting.egenix.com/
::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/