Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PurePathBase shouldn't cache drive/root/tail/string #10

Closed
barneygale opened this issue Dec 22, 2023 · 2 comments
Closed

PurePathBase shouldn't cache drive/root/tail/string #10

barneygale opened this issue Dec 22, 2023 · 2 comments

Comments

@barneygale
Copy link
Owner

PurePathBase has a few slots and methods that facilitate fast path object generation:

  • _drv, _root, _tail_cached: roughly, the result of os.path.splitroot() on the path
  • _str: the normalized path string
  • _make_child_relpath(): used when walking directories
  • _from_parsed_parts(): used in parent, parents, with_name(), relative_to()

These features are useful in PurePath, where speed is important, but much less so in PurePathBase, where the clarity of the interfaces and interactions should win out.

It should be possible to move them to PurePath, leaving PurePathBase with only _raw_paths and _resolving slots.

@barneygale
Copy link
Owner Author

This might also make it possible to implement PathBase.resolve() without spinning up loads of path objects.

@barneygale
Copy link
Owner Author

Upstream issue: python/cpython#113528

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant