- pathlib's `Path.resolve()` resolves symlinks, which can lead to bugs when working with relative paths.
- `Path.resolve()` can make it difficult to find files relative to the original path.
- `Path.parent` should not be used after calling `Path.resolve()`.
- Use `os.path.normalize(os.path.abspath(...))` instead of `Path.resolve()` to remove ".." occurrences and make paths absolute.
- `Path.resolve()` may be useful for creating a canonical representation of files, but this is a rare use case.
- In most cases, it's better to avoid using `Path.resolve()` as it can be a source of bugs.
- Some users may prefer to resolve symlinks in certain scenarios, but this is not the most common behavior.
- Programs can use a flag to allow users to choose whether or not to resolve symlinks.
- Many users do not put their source code in symlinks, so `Path.resolve()` is not a concern for them.
- It's important to use absolute and normalized paths when passing files among APIs.
pydev.blogspot.com
pydev.blogspot.com
Create attached notes ...
