On Oct 29, 2019, at 09:05, Paul Moore <p.f.mo...@gmail.com> wrote:
> 
> Having  a real example would help decide the appropriate behaviour for
> corner cases like x.with_stem('name.ext').

I just realized that my use case doesn’t help answer your corner case. 
Hopefully the OP’s will have one. But I can imagine one that does.

If you wanted my safe_create function to do Mac-like “copy 3 of spam.eggs.txt” 
instead of Windows-style “spam.eggs (3).txt”, then you would end up calling 
path.with_stem("copy 3 of spam.eggs"), and you would definitely want the 
".eggs" to be added to rather than replaced. So, the OP’s first implementation 
would be the right one, not his second.

Hopefully that doesn’t contradict what you’d want from the OP’s use case. :)

_______________________________________________
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/SGQB6LTXYDRISN2VL656YRYN47WQOAIY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to