Skip to content
This repository was archived by the owner on Oct 24, 2024. It is now read-only.
This repository was archived by the owner on Oct 24, 2024. It is now read-only.

Expose NodePath? #205

Closed
Closed
@TomNicholas

Description

@TomNicholas

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions