Pathlib absolute() vs. resolve()

From my naive point of view as a (Windows) user it appears very surprising that absolute() remains undocumented. So far my impression is:

  • absolute() works in all versions of Python.
  • There is no alternative.
  • The commonly recommended alternative is not working in any version of Python. Even if the bugs get fixed it will remain a quite problematic API due to these (current and past) problems.
  • The term absolute() is much clearer and to the point anyway. It is self-explanatory, fits the user intent, widely known standard terminology and other (documented) API methods like is_absolute().
  • The term resolve() seems comparatively exotic. The documentation gives the impression it is mainly about something related to symlinks, and getting an absolute path seems to be a vague side-effect at best (if it worked). For Windows I would not have considered this at all if it had not been mentioned on Stack Overflow.
  • It seems unlikely / inadvisable to remove or change the undocumented absolute() method. It is the top search engine result, the intuitive self-evident solution, it works and thus undoubtedly already in wide real world use.

Is this impression wrong? Is there a working alternative to absolute()? Thanks.

1 Like