
Beman wrote:
in the context of a tree as being a thing with no children. An interior node like a directory that has files or other directories in it is usually not called a "leaf."
Right. And "leaf" never returns an interior node of a path.
I wonder if this is the best possible name?
The names used by the filesystem library were carefully chosen as a matched set. So you can't change a single name without making a corresponding change to the other names (like "branch") it is related to.
Is a tree a good way to describe a path? I mean, the path itself is a basically a list of names right? Many of us think of the filesystem itself as a tree (whether it is or not, at least it is a digraph). To me a path is a sequence (a list) of connected nodes in a graph (or tree), and this analogy shold hold with filesystem. A leaf is a node in a tree with no out-edges, and the last node in a path may or may not be a leaf. I think that python (since somebody mentioned that already) uses a 'head' and a 'tail' to describe what filesystem currently calls the 'branch_path' and 'leaf' of a path. That makes sense since to me since it captures the notion that a path is a sequence of names. -- John Femiani