> On 1 Apr 2019, at 02:23, David Mertz <[email protected]> wrote: > >> On Sun, Mar 31, 2019, 8:11 PM Steven D'Aprano <[email protected]> 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.
Doing this with a for loop and without_suffix is fine though. Without without_suffix it's suddenly error prone. With a without_suffix that takes a typle it's unclear what happens without reading the code. I think a single string argument is a great sweet spot: avoid the most error prone part and keep the loop in user code. / Anders
_______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
