r/Python • • Sep 15 '20

Resource Python 3.9: All You need to know 👊

https://ayushi7rawat.hashnode.dev/python-39-all-you-need-to-know
1.2k Upvotes

204 comments sorted by

View all comments

Show parent comments

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.

1

u/yad76 Sep 16 '20

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.