Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-23 Thread Ethan Furman
On 07/21/2014 03:26 PM, Victor Stinner wrote: The PEP is accepted. Thanks, Victor! Congratulations, Ben! -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.pyt

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Antoine Pitrou
Le 21/07/2014 18:26, Victor Stinner a écrit : I'm happy because the final API is very close to os.path functions and pathlib.Path methods. Python stays consistent, which is a great power of this language! By the way, http://bugs.python.org/issue19767 could benefit too. Regards Antoine. ___

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Akira Li
Ben Hoyt writes: >> Note: listdir() accepts an integer path (an open file descriptor that >> refers to a directory) that is passed to fdopendir() on POSIX [4] i.e., >> *you can't use scandir() to replace listdir() in this case* (as I've >> already mentioned in [1]). See the corresponding tests fr

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Victor Stinner
2014-07-22 4:27 GMT+02:00 Ben Hoyt : >> The PEP is accepted. > > Superb. Could you please update the PEP with the Resolution and > BDFL-Delegate fields? Done. Victor ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listi

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Ben Hoyt
Makes sense, thanks. -Ben On Tue, Jul 22, 2014 at 4:57 PM, Nick Coghlan wrote: > > On 23 Jul 2014 02:18, "Victor Stinner" wrote: >> >> 2014-07-22 17:52 GMT+02:00 Ben Hoyt : >> > However, given that we have to support this for listdir() anyway, I >> > think it's worth reconsidering whether scandi

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Nick Coghlan
On 23 Jul 2014 02:18, "Victor Stinner" wrote: > > 2014-07-22 17:52 GMT+02:00 Ben Hoyt : > > However, given that we have to support this for listdir() anyway, I > > think it's worth reconsidering whether scandir()'s directory argument > > can be an integer FD. Given that listdir() already supports

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Victor Stinner
2014-07-22 17:52 GMT+02:00 Ben Hoyt : > However, given that we have to support this for listdir() anyway, I > think it's worth reconsidering whether scandir()'s directory argument > can be an integer FD. Given that listdir() already supports it, it > will almost certainly be asked for later anyway

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Ben Hoyt
> Note: listdir() accepts an integer path (an open file descriptor that > refers to a directory) that is passed to fdopendir() on POSIX [4] i.e., > *you can't use scandir() to replace listdir() in this case* (as I've > already mentioned in [1]). See the corresponding tests from [2]. > > [1] https:/

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Akira Li
Ben Hoyt writes: > I think if I were doing this from scratch I'd reimplement listdir() in > Python as "return [e.name for e in scandir(path)]". ... > So my basic plan is to have an internal helper function in > posixmodule.c that either yields DirEntry objects or strings. And then > listdir() wou

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Victor Stinner
Modify os.listdir() to use os.scandir() is not part of the PEP, you should not do that. If you worry about performances, try to implement my free list idea. You may modify the C code of listdir() to share as much code as possible. I mean you can implement your idea in C. Victor __

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-21 Thread Ben Hoyt
> I asked privately Guido van Rossum if I can be the BDFL-delegate for > the PEP 471 and he agreed. I accept the latest version of the PEP: > > http://legacy.python.org/dev/peps/pep-0471/ Thank you! > The PEP also explicitly mentions that os.walk() will be modified to > benefit of the new os.

[Python-Dev] PEP 471 "scandir" accepted

2014-07-21 Thread Victor Stinner
Hi, I asked privately Guido van Rossum if I can be the BDFL-delegate for the PEP 471 and he agreed. I accept the latest version of the PEP: http://legacy.python.org/dev/peps/pep-0471/ I consider that the PEP 471 "scandir" was discussed enough to collect all possible options (variations of th