Title: Glob behavior is inconsistent across libraries · Issue #106747 · python/cpython · GitHub
Open Graph Title: Glob behavior is inconsistent across libraries · Issue #106747 · python/cpython
X Title: Glob behavior is inconsistent across libraries · Issue #106747 · python/cpython
Description: the [Python] docs for pathlib.glob are unclear on the meaning of ** You are right, and it gets even more confusing: glob.glob('**') returns dirs and files, non-recursively, not including . glob.glob('**', recursive=True) returns dirs and...
Open Graph Description: the [Python] docs for pathlib.glob are unclear on the meaning of ** You are right, and it gets even more confusing: glob.glob('**') returns dirs and files, non-recursively, not including . glob.glo...
X Description: the [Python] docs for pathlib.glob are unclear on the meaning of ** You are right, and it gets even more confusing: glob.glob('**') returns dirs and files, non-recursively, not including . ...
Opengraph URL: https://github.com/python/cpython/issues/106747
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Glob behavior is inconsistent across libraries","articleBody":"\u003e the [Python] docs for `pathlib.glob` are unclear on the meaning of `**`\r\n\r\nYou are right, and it gets even more confusing:\r\n\r\n* `glob.glob('**')` returns dirs and files, non-recursively, not including `.`\r\n* `glob.glob('**', recursive=True)` returns dirs and files, recursively, not including `.`\r\n* `list(pathlib.Path('.').glob('**'))` returns only dirs, recursively, and also includes `.`\r\n\r\nI think there should be a Python upstream issue to document all of that, including the differences between `glob` and `pathlib`.\r\n\r\nThen `zipp` could implement what's documented for `pathlib`.\r\n\r\n## Repro\r\n\r\nPython 3.10.11\r\n\r\n```sh\r\nmkdir -p dir/subdir ; touch toplevel.txt dir/indir.txt\r\n```\r\n\r\ncreates:\r\n\r\n```\r\ntoplevel.txt\r\ndir/\r\n indir.txt\r\n subdir/\r\n```\r\n\r\n```python\r\n\u003e\u003e\u003e import glob, pathlib\r\n\r\n\u003e\u003e\u003e glob.glob('**')\r\n['dir', 'toplevel.txt']\r\n\r\n\u003e\u003e\u003e glob.glob('**', recursive=True)\r\n['dir', 'dir/subdir', 'dir/indir.txt', 'toplevel.txt']\r\n\r\n\u003e\u003e\u003e list(pathlib.Path('.').glob('**'))\r\n[PosixPath('.'), PosixPath('dir'), PosixPath('dir/subdir')]\r\n```\r\n\r\n_Originally posted by @nh2 in https://github.com/jaraco/zipp/issues/102#issuecomment-1634883323_\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-112365\n* gh-115056\n* gh-116319\n* gh-116518\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/jaraco","@type":"Person","name":"jaraco"},"datePublished":"2023-07-14T16:00:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/106747/cpython/issues/106747"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fcc18287-8f8b-ee0c-c78b-0d08064b4a92 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 963C:26204A:18161ED:204B4C3:6969BECC |
| html-safe-nonce | e89531f144240124f4fa4922e734d5d50676d918f1df1eb79f7a11dfe5a125eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjNDOjI2MjA0QToxODE2MUVEOjIwNEI0QzM6Njk2OUJFQ0MiLCJ2aXNpdG9yX2lkIjoiNjgzODA0MTgyMDU1NDQ0NDQ5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d0e68ed89b5aee74c6f02894b344d9e41f4e6bde70ea0907a75619af4e5f2efc |
| hovercard-subject-tag | issue:1805110819 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/106747/issue_layout |
| twitter:image | https://opengraph.githubassets.com/71a84a2158b8705ce668d728bceae9750b9c525a74bcfe16d14321eef2e84ef4/python/cpython/issues/106747 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/71a84a2158b8705ce668d728bceae9750b9c525a74bcfe16d14321eef2e84ef4/python/cpython/issues/106747 |
| og:image:alt | the [Python] docs for pathlib.glob are unclear on the meaning of ** You are right, and it gets even more confusing: glob.glob('**') returns dirs and files, non-recursively, not including . glob.glo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jaraco |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width