Open 5j9 opened 1 year ago
Nice. Sounds good. I welcome the contributions. In cases where the functionality is duplicative and the pathlib syntax is inarguably as good, let's also deprecate any local pecularities.
In #218, I'm working on adding support for .suffix
, .with_stem
, and .with_name
.
Looks like link_to was replaced by hardlink_to and removed.
I'm looking at symlink_to
and hardlink_to
, and it's interesting. pathlib's implementation is very different, switching the order of arguments. It's not obvious why the order of arguments was switched (from os.path equivalents) and in fact, the order was only switched in symlink_to originally and later in hardlink_to. I'm not sure yet if the other ones should be deprecated. I'm leaning toward keeping them for now.
Another difference is that pathlib doesn't return anything for symlink_to
or hardlink_to
, but the path implementation does. It seems to me that returning something would be useful, but I'm yet unsure what is best to return. I'll probably start with not returning anything at all (matching the pathlib behavior) unless there's a case to be made for a returned value.
I observe that Path.owner
and pathlib.Path.owner()
are incompatible. It won't be possible to align those without first deprecating .owner
.
I took at replace
. This case is a more difficult one, because path.Path
is a str
subclass, so already has a replace that's different from how pathlib.Path.replace works.
I'm thinking maybe this library can support both:
str.replace
, but wrap in a "next" Path class.
This project does aspire to align with pathlib where possible, so it should probably do the same (and probably implement
iterdir
at the same time, if it's not present already).Originally posted by @jaraco in https://github.com/jaraco/path/issues/212#issuecomment-1623882608
Here some other methods that are worth considering: