Skip to content

gh-136059: docs: pathlib: Mention that iterdir() is surprisingly not streaming #136060

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,12 @@ Reading directories
If the path is not a directory or otherwise inaccessible, :exc:`OSError` is
raised.

.. warning::
Despite its name and being a generator, this function currently
does not stream directory entries: It reads all directory
entries into memory before yielding the first entry.
If you need constant-memory iteration across a large number of
directory entries, use :func:`os.scandir` instead.

.. method:: Path.glob(pattern, *, case_sensitive=None, recurse_symlinks=False)

Expand Down
Loading