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
Ben Hoyt benh...@gmail.com 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
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]
2014-07-22 17:52 GMT+02:00 Ben Hoyt benh...@gmail.com:
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
On 23 Jul 2014 02:18, Victor Stinner victor.stin...@gmail.com wrote:
2014-07-22 17:52 GMT+02:00 Ben Hoyt benh...@gmail.com:
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
Hi all,
I've been happily working on the SSL module backports for Python2 (pursuant to
PEP466), and I've hit something of a snag:
In python3, the SSLSocket keeps a weak reference to the underlying socket,
rather than a strong reference, as Python2 uses.
Unfortunately, due to the way sockets
Makes sense, thanks. -Ben
On Tue, Jul 22, 2014 at 4:57 PM, Nick Coghlan ncogh...@gmail.com wrote:
On 23 Jul 2014 02:18, Victor Stinner victor.stin...@gmail.com wrote:
2014-07-22 17:52 GMT+02:00 Ben Hoyt benh...@gmail.com:
However, given that we have to support this for listdir() anyway, I
Le 22/07/2014 17:03, Alex Gaynor a écrit :
The question is:
a) Should we backport weak referencing _socket.sockets (changing the structure
of the module seems overly invasive, albeit completely backwards
compatible)?
b) Does anyone know why weak references are used in the first place?
On 23 Jul 2014 07:28, Antoine Pitrou anto...@python.org wrote:
Le 22/07/2014 17:03, Alex Gaynor a écrit :
The question is:
a) Should we backport weak referencing _socket.sockets (changing the
structure
of the module seems overly invasive, albeit completely backwards
compatible)?
2014-07-22 4:27 GMT+02:00 Ben Hoyt benh...@gmail.com:
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
Le 22/07/2014 17:44, Nick Coghlan a écrit :
As for 2.x, I don't see why you couldn't just continue using a strong
reference.
As Antoine says, if the cycle already exists in Python 2 (and it sounds
like it does), we can just skip backporting the weak reference change.
No, IIRC there
Ben Hoyt benh...@gmail.com 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
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.
13 matches
Mail list logo