Skip to content

bpo-39285: Clarify example for PurePath.match #19458

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

Merged
merged 1 commit into from
Apr 19, 2020

Conversation

timlo
Copy link
Contributor

@timlo timlo commented Apr 10, 2020

Fixes Issue39285

The example incorrectly returned True for match.

Furthermore the example is ambiguous in its usage of PureWindowsPath.
Windows is case-insensitve, however the underlying match functionality
utilizes fnmatch.fnmatchcase.

https://bugs.python.org/issue39285

https://bugs.python.org/issue39285

Automerge-Triggered-By: @pitrou

@pitrou
Copy link
Member

pitrou commented Apr 18, 2020

I don't understand this PR. The point of this snippet in the documentation is to show that case-sensitivity follows platform defaults.
Perhaps the example should be enhanced to show how Posix and Windows paths differ, e.g.:

>>> PurePosixPath('b.py').match('*.PY')
False
>>> PureWindowsPath('b.py').match('*.PY')
True

@pitrou
Copy link
Member

pitrou commented Apr 18, 2020

cc @barneygale

@barneygale
Copy link
Contributor

Sounds like a wording problem. This sentence:

As with other methods, case-sensitivity is observed:

Can be taken to mean that path.match() is always case-sensitive, regardless of platform. It could be tweaked to say:

As with other methods, the flavour's case-folding semantics are respected:

I agree that an additional example involving PurePosixPath would help.

@timlo timlo force-pushed the fix-issue-39285 branch from c89f83f to 787a418 Compare April 19, 2020 00:09
Fixes Issue39285

Provide additional example and update wording to remove ambiguity around
the match functionlatiy.
@timlo timlo force-pushed the fix-issue-39285 branch from 787a418 to 72a8105 Compare April 19, 2020 00:10
@timlo
Copy link
Contributor Author

timlo commented Apr 19, 2020

Thanks! I've updated the example and wording to incorporate the feedback.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, thank you

@miss-islington miss-islington merged commit c12375a into python:master Apr 19, 2020
@miss-islington
Copy link
Contributor

Thanks @timlo for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 19, 2020
Fixes Issue39285

The example incorrectly returned True for match.

Furthermore the example is ambiguous in its usage of PureWindowsPath.
Windows is case-insensitve, however the underlying match functionality
utilizes fnmatch.fnmatchcase.

Automerge-Triggered-By: @pitrou
(cherry picked from commit c12375a)

Co-authored-by: Tim Lo <[email protected]>
@bedevere-bot
Copy link

GH-19597 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 19, 2020
Fixes Issue39285

The example incorrectly returned True for match.

Furthermore the example is ambiguous in its usage of PureWindowsPath.
Windows is case-insensitve, however the underlying match functionality
utilizes fnmatch.fnmatchcase.

Automerge-Triggered-By: @pitrou
(cherry picked from commit c12375a)

Co-authored-by: Tim Lo <[email protected]>
@bedevere-bot
Copy link

GH-19598 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Apr 19, 2020
Fixes Issue39285

The example incorrectly returned True for match.

Furthermore the example is ambiguous in its usage of PureWindowsPath.
Windows is case-insensitve, however the underlying match functionality
utilizes fnmatch.fnmatchcase.

Automerge-Triggered-By: @pitrou
(cherry picked from commit c12375a)

Co-authored-by: Tim Lo <[email protected]>
miss-islington added a commit that referenced this pull request Apr 19, 2020
Fixes Issue39285

The example incorrectly returned True for match.

Furthermore the example is ambiguous in its usage of PureWindowsPath.
Windows is case-insensitve, however the underlying match functionality
utilizes fnmatch.fnmatchcase.

Automerge-Triggered-By: @pitrou
(cherry picked from commit c12375a)

Co-authored-by: Tim Lo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants