Documentation
The documentation says:
|
Return the canonical path of the specified filename, eliminating any symbolic |
|
links encountered in the path (if they are supported by the operating |
|
system). On Windows, this function will also resolve MS-DOS (also called 8.3) |
|
style names such as ``C:\\PROGRA~1`` to ``C:\\Program Files``. |
So it merely mentions symlink resolution, but not what else it means (if anything).
It does however mention that whatever it does is OS dependent:
|
This function emulates the operating system's procedure for making a path |
|
canonical, which differs slightly between Windows and UNIX with respect |
|
to how links and subsequent path components interact. |
IMO, it should be clearly documented what it does or at least:
- what it guarantees to the least (For example will the pathname be absolute? Will it be normalised?)
and/or:
- which OS function it’s identical to, like on POSIX where that would probably realpath(), and whether there are differences to that
Especially since IMO "canonical" pathname (though I think it has no formal definition, or is there anything in POSIX?) means rather just that there are no symlinks left, i.e. that the file is "reached" by its true (=canonical) name.
But that could still be a relative pathname, and perhaps even one that is not normalised.
Cheers,
Chris.
Linked PRs
Documentation
The documentation says:
cpython/Doc/library/os.path.rst
Lines 406 to 409 in 2fd09b0
So it merely mentions symlink resolution, but not what else it means (if anything).
It does however mention that whatever it does is OS dependent:
cpython/Doc/library/os.path.rst
Lines 416 to 418 in 2fd09b0
IMO, it should be clearly documented what it does or at least:
and/or:
Especially since IMO "canonical" pathname (though I think it has no formal definition, or is there anything in POSIX?) means rather just that there are no symlinks left, i.e. that the file is "reached" by its true (=canonical) name.
But that could still be a relative pathname, and perhaps even one that is not normalised.
Cheers,
Chris.
Linked PRs