[issue44069] pathlib.Path.glob's generator is not a real generator

2021-05-21 Thread Terry J. Reedy
Terry J. Reedy added the comment: I agree that from the outside is seems slightly bizarre to make an internal list to implement a function documented as returning an iterator. However, list(scandir) was added by Serhiy in #26032 with the comment that it made globbing 1.5-4 times faster.

[issue44069] pathlib.Path.glob's generator is not a real generator

2021-05-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The reason is different. The scandir() iterator should be closed before we go recursively deep in the directory tree. Otherwise we can reach the limit of open file descriptors (especially if several glob()s are called in parallel). See issue22167.

[issue44069] pathlib.Path.glob's generator is not a real generator

2021-05-12 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44069] pathlib.Path.glob's generator is not a real generator

2021-05-11 Thread Elijah Rippeth
Change by Elijah Rippeth : -- versions: +Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker ___ ___

[issue44069] pathlib.Path.glob's generator is not a real generator

2021-05-07 Thread Elijah Rippeth
New submission from Elijah Rippeth : I have a directory with hundreds of thousands of text files. I wanted to explore one file, so I wrote the following code expecting it to happen basically instantaneously because of how generators work: ```python from pathlib import Path base_dir =