Re: [Python-Dev] pathlib+os/shutil feedback

2016-04-11 Thread Brett Cannon
On Mon, 11 Apr 2016 at 13:40 Sven R. Kunze  wrote:

> On 10.04.2016 16:51, Paul Moore wrote:
> > On 10 April 2016 at 15:07, Sven R. Kunze  wrote:
> >> If there's some agreement to change things with respect to those 5
> points, I
> >> am willing to put some time into it.
> > In broad terms I agree with these points. Thanks for doing the
> > research. It would certainly be good to try to improve pathlib based
> > on this sort of feedback while it is still provisional.
>
> I'd appreciate some guidance on this. Just let me know what I can do
> since I don't know the processes of hacking CPython.
>

https://docs.python.org/devguide/ and
https://mail.python.org/mailman/listinfo/core-mentorship are your friends.
:)

For new features of a module you can discuss it on python-ideas first
before proposing a patch if you're worried a patch implementing the feature
might get rejected and you don't want to risk wasting your time.

-Brett
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] pathlib+os/shutil feedback

2016-04-11 Thread Sven R. Kunze

On 10.04.2016 16:51, Paul Moore wrote:

On 10 April 2016 at 15:07, Sven R. Kunze  wrote:

If there's some agreement to change things with respect to those 5 points, I
am willing to put some time into it.

In broad terms I agree with these points. Thanks for doing the
research. It would certainly be good to try to improve pathlib based
on this sort of feedback while it is still provisional.


I'd appreciate some guidance on this. Just let me know what I can do 
since I don't know the processes of hacking CPython.



"""
Path.rglob(pattern)
Walk down a given path; a wrapper for "os.scandir"/"os.listdir".
"""

However, at least in 3.5, Path.rglob does *not* wrap scandir. There's
a difference in principle, in that scandir (DirEntry) objects cache
stat data, where pathlib does not. Whether that makes using scandir in
Path.rglob impossible, I don't know. Ideally I'd like to see pathlib
modified to use scandir (because otherwise there will always be people
saying "use os.walk rather than scandir, as it's faster) - or if it's
not possible to do so because of the difference in principle, then I'd
like to see a clear discussion of the issue in the docs, including the
recommended approach for people who want scandir performance *without*
having to abandon pathlib for lower level functions.


Good point. The proposed docstring was just to illustrate the 
functionality to the uninformed reader. People mostly trust the docs 
without digging deeper but they should be accurate of course.



Best,
Sven
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] pathlib+os/shutil feedback

2016-04-10 Thread Paul Moore
On 10 April 2016 at 15:07, Sven R. Kunze  wrote:
> If there's some agreement to change things with respect to those 5 points, I
> am willing to put some time into it.

In broad terms I agree with these points. Thanks for doing the
research. It would certainly be good to try to improve pathlib based
on this sort of feedback while it is still provisional.

One specific point - you say:

"""
Path.rglob(pattern)
Walk down a given path; a wrapper for "os.scandir"/"os.listdir".
"""

However, at least in 3.5, Path.rglob does *not* wrap scandir. There's
a difference in principle, in that scandir (DirEntry) objects cache
stat data, where pathlib does not. Whether that makes using scandir in
Path.rglob impossible, I don't know. Ideally I'd like to see pathlib
modified to use scandir (because otherwise there will always be people
saying "use os.walk rather than scandir, as it's faster) - or if it's
not possible to do so because of the difference in principle, then I'd
like to see a clear discussion of the issue in the docs, including the
recommended approach for people who want scandir performance *without*
having to abandon pathlib for lower level functions.

Paul
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com