Making paths absolute in os.path and pathlib

I don’t think we can or should guarantee that on many existing path APIs. Many of the path APIs are purely virtual “calculation” string manipulation methods having nothing to do with a filesystem, let alone any accessible or local filesystem. So no guarantees involving how they’ll be interpreted can be made from things like os.path.

We even document this for os.path.abspath which is says it is usually normpath(getcwd(), path) and normpath is documented as "This string manipulation may change the meaning of a path that contains symbolic links".

My concern is that any change to the behaviors of os.path and even most pathlib type methods is likely to break someones existing code. So tread lightly. Which leaves us in the “add a flag controlling desired behavior” scenario if a change is to be made.

10 Likes