On Sun, Mar 31, 2019, 8:11 PM Steven D'Aprano <steve@pearwood.info> wrote:
Regarding later proposals to add support for multiple affixes, to recursively delete the affix repeatedly, and to take an additional argument to limit how many affixes will be removed: YAGNI.
That's simply not true, and I think it's clearly illustrated by the example I gave a few times. Not just conceivably, but FREQUENTLY I write code to accomplish the effect of the suggested: basename = fname.rstrip(('.jpg', '.gif', '.png')) I probably do this MORE OFTEN than removing a single suffix. Obviously I *can* achieve this result now. I probably take a slightly different approach as the mood strikes me, with three or four different styles I've used. Actually, I've probably never done it in a way that wouldn't be subtly wrong for cases like 'base.jpg.gif.png.jpg.gif'.