Skip to content

Add Path.lexist() to pathlib #78318

Description

@lordmauve
mannequin
BPO 34137
Nosy @brettcannon, @nphilipp, @lordmauve, @tirkarthi, @e-kayrakli
PRs
  • gh-78318: Add pathlib.Path.lexists and related #21157
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2018-07-17.10:59:41.899>
    labels = ['3.7', 'type-feature', 'library']
    title = 'Add Path.lexist() to pathlib'
    updated_at = <Date 2020-06-25.15:50:44.247>
    user = 'https://github.com/lordmauve'

    bugs.python.org fields:

    activity = <Date 2020-06-25.15:50:44.247>
    actor = 'nils'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2018-07-17.10:59:41.899>
    creator = 'lordmauve'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34137
    keywords = ['patch']
    message_count = 5.0
    messages = ['321812', '321820', '321913', '321915', '372378']
    nosy_count = 6.0
    nosy_names = ['brett.cannon', 'nils', 'lordmauve', 'apatrushev', 'xtreak', 'e-kayrakli']
    pr_nums = ['21157']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue34137'
    versions = ['Python 3.7']

    Activity

    1. lordmauve commented on Jul 17, 2018

      lordmauvemannequin
      MannequinAuthor

      When using pathlib to manipulate paths that may be symlinks or regular files, a pattern that comes up frequently is this expression:

      path.is_symlink() or path.exists()

      os.path.lexists(path) can be used for this, but when using pathlib going back to os.path for this seems like defeat.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Jul 17, 2018
    3. e-kayrakli commented on Jul 17, 2018

      e-kayraklimannequin
      Mannequin

      I haven't contributed to Python yet and I can contribute this as a way for me to practice the PR process in Python.

      As this is a small addition, should I create a PR right away, or wait for a consensus here?

    4. brettcannon commented on Jul 18, 2018

      @brettcannon
      Member

      If you're okay with the PR being rejected because the decision is the method isn't desired, then feel free to go ahead and create a PR, Engin! But if you want to a better chance that it will eventually go in then I would wait for consensus.

    5. e-kayrakli commented on Jul 18, 2018

      e-kayraklimannequin
      Mannequin

      Thanks for the response Brett! I am not going to rush, then. But if I happen to have some free time and motivation to create the PR, I will just do it. I don't mind revising or getting rejected.

    6. nphilipp commented on Jun 25, 2020

      nphilippmannequin
      Mannequin

      I've come across this issue lately and proposed a PR which implements this and, analogous to os.stat(), adds a follow_symlinks parameter to Path.exists().

    7. transferred this issue fromon Apr 10, 2022
    8. AlexWaygood commented on Jan 8, 2023

      @AlexWaygood
      Member

      Closing as rejected -- see comments on the PR: #21157 (comment)

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytopic-pathlibtype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions