More than an answer to the question, I am trying to learn how to make sense of the Official Python Documentation.
I understand that Path
inherits from PurePath
, but I am unable to understand when to use which and why there is PurePath
& Path
instead of one.
In the list of alternatives, most are suggesting Path
while some are suggesting Pathlib
.
I am looking at os.path.dirname()
where they are suggesting PurePath.parent
. But I am getting the same result when I run pathlib.PurePath(file).parent.name
& pathlib.Path(file).parent.name
.
So, why did they use PurePath
for some & Path
for most. Why did they not suggest Path.parent
instead of PurePath.parent
?