A generic class that represents the system’s path flavour (instantiating it creates either a PurePosixPath or a PureWindowsPath):
>>> PurePath('setup.py') # Running on a Unix machinePurePosixPath('setup.py')
Each element of pathsegments can be either a string representing a path segment, or an object implementing the os.PathLike interface where the __fspath__() method returns a string, such as another path object:
Spurious slashes and single dots are collapsed, but double dots ('..') and leading double slashes ('//') are not, since this would change the meaning of a path for various reasons (e.g. symbolic links, UNC paths):
(a naïve approach would make PurePosixPath('foo/../bar') equivalent to PurePosixPath('bar'), which is wrong if foo is a symbolic link to another directory)
Pure path objects implement the os.PathLike interface, allowing them to be used anywhere the interface is accepted.
Changed in version 3.6: Added support for the os.PathLike interface.