Content-Length: 262724 | pFad | https://github.com/python/cpython/issues/111429

A4 Speed up `pathlib.PurePath.[is_]relative_to()` · Issue #111429 · python/cpython · GitHub
Skip to content

Speed up pathlib.PurePath.[is_]relative_to() #111429

@barneygale

Description

@barneygale

Both methods call self.with_segments() unconditionally. This can be skipped if the other argument is already an instance of PurePath, and no further (deprecated) positional arguments are given.

Also, relative_to() can inline the core of the is_relative_to() check to avoid the type/deprecated args checks.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/111429

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy