Skip to content

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

Closed
@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