Lena@gregtech.eu to Programmer Humor@programming.devEnglish · 25 days agoI wonder if this was made by AI or a shit programmergregtech.euimagemessage-square22linkfedilinkarrow-up12arrow-down10
arrow-up12arrow-down1imageI wonder if this was made by AI or a shit programmergregtech.euLena@gregtech.eu to Programmer Humor@programming.devEnglish · 25 days agomessage-square22linkfedilink
minus-squareDiplomjodler@lemmy.worldlinkfedilinkarrow-up0·24 days 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-up0·24 days agoWhat big advantages does pathlib provide? os.path works just fine
minus-squareDiplomjodler@lemmy.worldlinkfedilinkarrow-up1·24 days 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.
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.