Lena@gregtech.eu to Programmer Humor@programming.devEnglish · 1 day agoI wonder if this was made by AI or a shit programmergregtech.euimagemessage-square160fedilinkarrow-up1830arrow-down17
arrow-up1823arrow-down1imageI wonder if this was made by AI or a shit programmergregtech.euLena@gregtech.eu to Programmer Humor@programming.devEnglish · 1 day agomessage-square160fedilink
minus-squareDiplomjodler@lemmy.worldlinkfedilinkarrow-up21·10 hours agoI always get irrationally angry when i see python code using os.path instead of pathlib. What is this, the nineties?
minus-squareUndercoverUlrikHD@programming.devlinkfedilinkarrow-up2·3 hours agoWhat big advantages does pathlib provide? os.path works just fine
minus-squareDiplomjodler@lemmy.worldlinkfedilinkarrow-up5·2 hours ago Everything is in one library which offers consistency for all operations. You can use forward slashes on Windows paths, which makes for much better readability. You can access all the parts of a pathlib object with attributes like .stem, .suffix or .parent. You can easily find the differences between paths with .relative_to() You can easily build up complex paths with the / operator (no string additions). Just off the top of my head.
minus-squarenibbler@discuss.tchncs.delinkfedilinkEnglisharrow-up1·edit-22 hours agoif you don’t need those, why burden the program with another dependency?
minus-squareDiplomjodler@lemmy.worldlinkfedilinkarrow-up1·1 hour agoIt’s in the standard library, just like os or shutil.
minus-squareindepndnt@lemmy.worldlinkfedilinkarrow-up3·6 hours agoAnd what’s with the string addition? Never heard of f-strings or even .format()?
minus-squareaxEl7fB5@lemmy.cafelinkfedilinkEnglisharrow-up5·7 hours agoBe the change you want to see in the world.
I always get irrationally angry when i see python code using os.path instead of pathlib. What is this, the nineties?
What big advantages does pathlib provide? os.path works just fine
Just off the top of my head.
if you don’t need those, why burden the program with another dependency?
It’s in the standard library, just like os or shutil.
deleted by creator
And what’s with the string addition? Never heard of f-strings or even .format()?
Make a PR
Be the change you want to see in the world.