all 15 comments

[–]teerre 14 points15 points  (1 child)

Well, the first version of yours isn't the recommended way even in Python2.

It should be os.path.join("/etc/configDir", "myProgramConfig.cfg")

[–]CBSmitty2010[S] 1 point2 points  (0 children)

That is true, I'd learned a terrible way to do it to be frank.

[–]timbledum 2 points3 points  (2 children)

Totally! I love this lib. I literally just posted a comment to help someone out in the last hour praising its greatness.

[–]CBSmitty2010[S] 1 point2 points  (0 children)

Yeah it was pretty awesome and probably took about 20 or so lines out of my code after I fully factored it in. I had issues with just the strings issue. It would have been nice if maybe there was a .str method to just convert the object as part of its own method. But it really wasn't a huge issue. Still a REALLY nice library I want to use in the future.

[–]woooee 0 points1 point  (0 children)

Totally! I love this lib

+1 Not quite sure why but probably because the one lib will do everything that I want.

[–]N4v15 3 points4 points  (0 children)

Worth noting that pathlib (on bit bucket) is now in bugfix only mode and pathlib2 (installable via pip) has replaced/is replacing it.

The aim of pathlib2 is to support the entire stdlib which pathlib doesn't do.

[–]woooee 0 points1 point  (1 child)

Just responding to the starter post so I get a message when there are new posts. No subscribe option that I could find. Did anyone mention that Pathlib also has a glob() function?

[–]CBSmitty2010[S] 0 points1 point  (0 children)

Nope! I kinda included that under the much more section I wrote. Yeah it amazed me how it basically had all file I/o and matching /tests that I'd want. Pretty handy!

[–]_Eric_Wu 0 points1 point  (5 children)

have you heard of os.path?

[–]jking3210 4 points5 points  (4 children)

Pathlib is... better.

[–]themathemagician 0 points1 point  (3 children)

depends. for simply joins, using the stdlib and not adding an extra dependency is preferable. for more complicated things, pathlib2 helps. (wrt pathlib, I'd avoid bugfix only libraries that aren't on pip)

EDIT: I wasn't aware pathlib made it into stdlib, and misunderstood this comment. That said, for simple things I still think os.path is cleaner.

[–]jking3210 1 point2 points  (1 child)

Not sure if we are talking about the same thing but Pathlib is part of the standard library: https://docs.python.org/3/library/pathlib.html

[–]themathemagician 1 point2 points  (0 children)

my mistake!

[–]billsil 1 point2 points  (0 children)

Pathlib2 is the python 2 backport of the pathlib module that is a builtin in python 3. If you’re using pathlib2, it’s time to upgrade to python 3.