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

Provide samefile() on Path objects #63974

Closed
pitrou opened this issue Nov 25, 2013 · 9 comments
Closed

Provide samefile() on Path objects #63974

pitrou opened this issue Nov 25, 2013 · 9 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@pitrou
Copy link
Member

pitrou commented Nov 25, 2013

BPO 19775
Nosy @gvanrossum, @pitrou, @vstinner, @vajrasky
Files
  • pathlib_samefile.patch
  • pathlib_samefile_v2.patch
  • pathlib_samefile_v3.patch
  • 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 = <Date 2014-05-13.08:55:56.570>
    created_at = <Date 2013-11-25.19:48:21.236>
    labels = ['type-feature', 'library']
    title = 'Provide samefile() on Path objects'
    updated_at = <Date 2014-05-13.08:55:56.570>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2014-05-13.08:55:56.570>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-05-13.08:55:56.570>
    closer = 'pitrou'
    components = ['Library (Lib)']
    creation = <Date 2013-11-25.19:48:21.236>
    creator = 'pitrou'
    dependencies = []
    files = ['32916', '32927', '32979']
    hgrepos = []
    issue_num = 19775
    keywords = ['patch']
    message_count = 9.0
    messages = ['204386', '204639', '204880', '204887', '204923', '205263', '205270', '218413', '218415']
    nosy_count = 6.0
    nosy_names = ['gvanrossum', 'pitrou', 'vstinner', 'Arfrever', 'python-dev', 'vajrasky']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19775'
    versions = ['Python 3.5']

    @pitrou
    Copy link
    Member Author

    pitrou commented Nov 25, 2013

    It would probably be useful to provide samefile() on Path objects - basically doing the same thing as os.path.samefile().

    @pitrou pitrou added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 25, 2013
    @vstinner
    Copy link
    Member

    I like the idea :-)

    @vajrasky
    Copy link
    Mannequin

    vajrasky mannequin commented Dec 1, 2013

    Here is the patch.

    @Arfrever
    Copy link
    Mannequin

    Arfrever mannequin commented Dec 1, 2013

    About doc string in patch:

    1. s/same/the same/
    2. "same" is usually used with "as", not "with":
      https://books.google.com/ngrams/graph?content=same+as%2Csame+with%2Csame+to&year_start=1800&year_end=2000&corpus=15&smoothing=3

    @vajrasky
    Copy link
    Mannequin

    vajrasky mannequin commented Dec 1, 2013

    Updated grammar according to Arfrever's review. Thanks!

    Anyway, should samefile accepts only string? Or should it accept Path object as well?

    @pitrou
    Copy link
    Member Author

    pitrou commented Dec 4, 2013

    Thanks for the patch! Some comments:

    1. It should path objects as well as str objects.
    2. I don't think you have to call resolve() here.
    3. you should probably test what happens when one of the files doesn't exist
    4. you need to update the documentation too

    @vajrasky
    Copy link
    Mannequin

    vajrasky mannequin commented Dec 5, 2013

    Thanks for the review!

    Attached the patch addressing the request by Antoine.

    @pitrou
    Copy link
    Member Author

    pitrou commented May 13, 2014

    Sorry, it seems I have let this issue slip. I will update the patch and commit it soon!

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 13, 2014

    New changeset 197ac5d79456 by Antoine Pitrou in branch 'default':
    Issue bpo-19775: Add a samefile() method to pathlib Path objects.
    http://hg.python.org/cpython/rev/197ac5d79456

    @pitrou pitrou closed this as completed May 13, 2014
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants