I would agree for that case, but I would say one place where it does give the wrong answer (or at least, a different answer from splitext etc) is with dotfiles. Ie '.config' denotes a hidden file on unix, and pathlib and splitext will treat it as the stem '.config' with empty extension, rather than an empty sten with ".config" suffix.
Yeah, good point. I was focusing just on the double extension case that was cited. Looks like the pathlib and os.path implementations are just doing and rfind for . and then compensating for the case where it might be at the beginning.
3
u/Brian Sep 16 '20
I would agree for that case, but I would say one place where it does give the wrong answer (or at least, a different answer from splitext etc) is with dotfiles. Ie '.config' denotes a hidden file on unix, and pathlib and splitext will treat it as the stem '.config' with empty extension, rather than an empty sten with ".config" suffix.