Expose NodePath? #205
Description
The concept of a file-like path between nodes is often useful. Internally I have an abstraction for this, the NodePath
class, but publicly we currently only ever accept and return string paths.
NodePath
is a powerful class because it inherits directly from pathlib.PurePosixPath
, so it automatically has a .relative_to
method, a .parts
property, a .root
, supports joining paths via the /
operator, and is coercible into a string.
We could make NodePath
public, and return it from node.path
instead of a string as we currently do. This would be a breaking change, but would be nice for users for some tree manipulations, e.g. joining paths. They could still get to the string very easily via node.path.str
.
What do we think about this? If we're going to change it we should change it sooner rather than later.