Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Addpathlib.Path.from_uri() classmethod #107465

Closed
Labels
@barneygale

Description

@barneygale

Feature or enhancement

Addpathlib.Path.from_uri() classmethod that creates a path objects from a 'file' URI, likefile:///c:/windows. This method should acceptRFC 8089file: URIs, including variant forms.

Pitch

The proposed method is the counterpart ofpathlib.Path.as_uri(). As we continue to open up pathlib for subclassing, user subclasses of path classes will begin to appear with their ownas_uri() methods returning URIs likes3://,ftp://. These subclasses will likely also support parsing URIs to create paths. However, there is currently no defined interface for doing this in pathlib, and users will be tempted to accept URIs in initialisers, which produces a confusing interface. If pathlib instead defines afrom_uri() classmethod, there is one clear and obvious method that subclasses may override.

Previous discussion

Seehttps://discuss.python.org/t/make-pathlib-extensible/3428/136 and subsequent posts

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp