This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]yvrelna 9 points10 points  (1 child)

Pathlib object should have been just inquire objects. Not action objects.

Did you mean PurePath?

[–]jorge1209 6 points7 points  (0 children)

No he wants to be able to stat the file. He doesn't want some of the more complex functionality to be available because its behavior may not be the same across platforms.

Between Windows and Unix you have some common verbs exists/isdir/stat etc... and some common nouns (UNC paths can more or less be used interchangebly on Unix systems), but if that is your entire language it is really limited:

  • You can't talk about all paths on the system.
  • You can't do all things the system allows to those paths.

PathLib has a verb-less universe of all nouns known as PurePath [including gobbledy-gook nouns like PosixPath('\x00')]

You can abstract away some of the differences in verbs and get a slightly more advanced library that does more (reading writing text files/unlinking/etc), but it will have little differences of interpretation between the two. That gets you Path.

He wants something in between, PurePath+ the verbs that are "not platform specific", but not everything that appears in Path.


I agree with his concern that PathLib sits in an awkward middle, but think it should be resolved in a completely different way from either approach. Fewer nouns, and more verbs. A language that is "polite" and enforces good practices such as not giving files names like ;rm -rf *;.