<div dir="ltr"><div><div>+1 on getting this in for 3.5.</div></div><div><br></div>If the only objection people are having is the stupid paint color of the name I don't care what it's called!  scandir matches the libc API of the same name.  iterdir also makes sense to anyone reading it.  Whoever checks this in can pick one and be done with it.  We have other Python APIs with iter in the name and tend not to be trying to mirror C so much these days so the iterdir folks do have a valid point.<div>

<br></div><div>I'm not a huge fan of the DirEntry object and the method calls on it instead of simply yielding tuples of (filename, partially_filled_in_stat_result) but I don't <i>really</i> care which is used as they both work fine and it is trivial to wrap with another generator expression to turn it into exactly what you want anyways.</div>

<div><br></div><div>Python not having the ability to operate on large directories means Python simply cannot be used for common system maintenance tasks.  Python being slow to walk a file system due to unnecessary stat calls (often each an entire io op. requiring a disk seek!) due to the existing information that it throws away not being used via listdir is similarly a problem. This addresses both.</div>

<div><br></div><div>IMNSHO, it is a single function, it belongs in the os module right next to listdir.</div><div><br></div><div>-gps</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 26, 2014 at 6:37 PM, Ben Hoyt <span dir="ltr"><<a href="mailto:benhoyt@gmail.com" target="_blank">benhoyt@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I don't mind iterdir() and would take it :-), but I'll just say why I<br>
chose the name scandir() -- though it wasn't my suggestion originally:<br>
<br>
iterdir() sounds like just an iterator version of listdir(), kinda<br>
like keys() and iterkeys() in Python 2. Whereas in actual fact the<br>
return values are quite different (DirEntry objects vs strings), and<br>
so the name change reflects that difference a little.<br>
<br>
I'm also -1 on windows_wildcard. I think it's asking for trouble, and<br>
wouldn't gain much on Windows in most cases anyway.<br>
<br>
-Ben<br>
<div><div class="h5"><br>
On Thu, Jun 26, 2014 at 7:43 PM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br>
> On 06/26/2014 04:36 PM, Tim Delaney wrote:<br>
>><br>
>> On 27 June 2014 09:28, MRAB wrote:<br>
>>><br>
>>><br>
>>> Personally, I'd prefer the name 'iterdir' because it emphasises that<br>
>>> it's an iterator.<br>
>><br>
>><br>
>> Exactly what I was going to post (with the added note that thee's an<br>
>> obvious symmetry with listdir).<br>
>><br>
>> +1 for iterdir rather than scandir<br>
>><br>
>> Other than that:<br>
>><br>
>> +1 for adding [it] to the stdlib<br>
><br>
><br>
> +1 for all of above<br>
><br>
> --<br>
> ~Ethan~<br>
><br>
> _______________________________________________<br>
> Python-Dev mailing list<br>
> <a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
> Unsubscribe:<br>
</div></div>> <a href="https://mail.python.org/mailman/options/python-dev/benhoyt%40gmail.com" target="_blank">https://mail.python.org/mailman/options/python-dev/benhoyt%40gmail.com</a><br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/greg%40krypto.org" target="_blank">https://mail.python.org/mailman/options/python-dev/greg%40krypto.org</a><br>
</div></div></blockquote></div><br></div>