arogozhnikov / arogozhnikov/python3_with_pleasure

Globbing with glob vs. pathlib

Open
#16 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
3.6k
Forks
187
PR merge metrics
No merged PRs in 30d

Description

It might be worth mentioning that `glob.glob` and `pathlib.Path.glob` work slightly differently. `glob.glob` [treats dotfiles specially](https://docs.python.org/3/library/glob.html), while `pathlib.Path.glob` uses `**` [only to match directories](https://docs.python.org/3/library/pathlib.html#pathlib.Path), not files. It's easy to use `pathlib.Path.glob` without reading the docs closely enough to realize the differences from `glob.glob` and bash globstar behavior, and thus construct a pattern that doesn't match what you want.

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the guide section covering file globbing, then compare its existing explanation with the linked Python documentation for glob.glob and pathlib.Path.glob. Add a clear note about dotfiles and the different meaning of **, with examples or wording that distinguishes pathlib behavior from bash globstar behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.