[Python-ideas] Re: pathlib enhancements

2021-01-18 Thread Random832
On Fri, Jan 8, 2021, at 15:47, Joseph Martinot-Lagarde wrote: > One remark about this : .tar.gz files are the exception rather than the > rule, and AFAIK maybe the only one ? It's pretty common to have dots in > filenames instead of blanks for example, and stem does the right thing > here : '/da

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread David Mertz
For my entire filesystem: 124920 cpython-38.pyc 50034 html.gz 31158 cpython-39.pyc 31032 d.ts 30415 cpython-37.pyc 21473 cpython-36.pyc 19000 js.map 9888 symbolic.png 5086 cpython-35.pyc 5004 1.gz 4657 cpython-38-x86_64-linux-gnu.so 4261 pypy36.pyc 4152 Debian.gz

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread David Mertz
On my system: % find ~ -name '*.*.*' | rev | cut -d. -f-2 | rev | sort | uniq -c | sort -nr | head -30 17278 d.ts 11314 js.map 6600 symbolic.png 4041 png.i 3968 cpython-37.pyc 2656 yarn-metadata.json 2614 yarn-tarball.tgz 2575 c.i 2526 csv.gz 1727 h.i 1659 opt-1.pyc

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread 2QdxY4RzWzUUiLuE
On 2021-01-10 at 05:03:08 +1100, Chris Angelico wrote: > On Sun, Jan 10, 2021 at 4:51 AM Stephen J. Turnbull > wrote: > > > > Joseph Martinot-Lagarde writes: > > > > > One remark about this : .tar.gz files are the exception rather than > > > the rule, and AFAIK maybe the only one ? > > > > Not

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread Chris Angelico
On Sun, Jan 10, 2021 at 4:51 AM Stephen J. Turnbull wrote: > > Joseph Martinot-Lagarde writes: > > > One remark about this : .tar.gz files are the exception rather than > > the rule, and AFAIK maybe the only one ? > > Not really. stem.ext -> stem.ext.zzz where zzz is a compression > extension i

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread Stephen J. Turnbull
Joseph Martinot-Lagarde writes: > One remark about this : .tar.gz files are the exception rather than > the rule, and AFAIK maybe the only one ? Not really. stem.ext -> stem.ext.zzz where zzz is a compression extension is a pretty common naming convention. For me ext == 'tar' is by far the mo

[Python-ideas] Re: pathlib enhancements

2021-01-08 Thread Joseph Martinot-Lagarde
Todd wrote: I'm in favor of most of these additions. I was a heavy user of path.py and I'm missing those "advanced" features in pathlib. > Stem with no suffixes > > The stem property only takes off the last suffix, but even in the example > given ('my/library.tar.gz') it isn't really useful beca

[Python-ideas] Re: pathlib enhancements

2021-01-07 Thread Sven R. Kunze
On 31.12.20 15:32, Todd wrote: 5. Stem with no suffixes The stem property only takes off the last suffix, but even in the example given ('my/library.tar.gz') it isn't really useful because the suffix has two parts ('.tar' and '.gz').  I suggest another property, probably c

[Python-ideas] Re: pathlib enhancements

2021-01-07 Thread Todd
On Thu, Jan 7, 2021, 10:54 Sven R. Kunze wrote: > I split my answers up to address different issues in different threads. > > > On 31.12.20 15:32, Todd wrote: > > Hi Sven, > > Thanks for your support and feedback. > > > On Thu, Dec 31, 2020, 07:23 Sven R. Kunze wrote: > >> Hi Todd, >> >> my comm

[Python-ideas] Re: pathlib enhancements

2021-01-07 Thread Sven R. Kunze
Last but not least, I tend more towards the "rmtree" method just to make it crystal clear to everyone. Maybe docs could cross-refer both methods. Tree manipulations are inherently complicated and a lot can go wrong. Symmetry is not 100% given as you might delete more than wh

[Python-ideas] Re: pathlib enhancements

2021-01-07 Thread Sven R. Kunze
I split my answers up to address different issues in different threads. On 31.12.20 15:32, Todd wrote: Hi Sven, Thanks for your support and feedback. On Thu, Dec 31, 2020, 07:23 Sven R. Kunze > wrote: Hi Todd, my comments below. Also would offer my time for

[Python-ideas] Re: pathlib enhancements

2020-12-31 Thread Todd
Hi Sven, Thanks for your support and feedback. On Thu, Dec 31, 2020, 07:23 Sven R. Kunze wrote: > Hi Todd, > > my comments below. Also would offer my time for reviewing/testing if > wanted. > > > On 22.11.20 20:53, Todd wrote: > > I know enhancements to pathlib gets brought up occasionally, bu

[Python-ideas] Re: pathlib enhancements

2020-12-31 Thread Sven R. Kunze
Hi Todd, my comments below. Also would offer my time for reviewing/testing if wanted. On 22.11.20 20:53, Todd wrote: I know enhancements to pathlib gets brought up occasionally, but it doesn't look like anyone has been willing to take the initiative and see things through to completion.  I am

[Python-ideas] Re: pathlib enhancements

2020-11-30 Thread Todd
Does anyone have any further thoughts on these? Should I split these into separate threads? On Sun, Nov 22, 2020 at 10:05 PM Todd wrote: > On Sun, Nov 22, 2020 at 9:49 PM Matt Wozniski wrote: > >> > I suggest adding an "exist_ok" argument to all of these, with >> > the default being "True" for

[Python-ideas] Re: pathlib enhancements

2020-11-22 Thread Todd
On Sun, Nov 22, 2020 at 9:49 PM Matt Wozniski wrote: > > I suggest adding an "exist_ok" argument to all of these, with > > the default being "True" for backwards-compatibility. This argument name > > is already in use elsewhere in pathlib. If this is False and the file is > > not present, a "Fi

[Python-ideas] Re: pathlib enhancements

2020-11-22 Thread Matt Wozniski
> I suggest adding an "exist_ok" argument to all of these, with > the default being "True" for backwards-compatibility. This argument name > is already in use elsewhere in pathlib. If this is False and the file is > not present, a "FileNotFoundError" is raised. For Path.mkdir, exist_ok=True inhi

[Python-ideas] Re: pathlib enhancements

2020-11-22 Thread Chris Angelico
On Mon, Nov 23, 2020 at 11:37 AM Todd wrote: >> It might be worth looking at this as "making shutil support Path >> objects", and then have the Path objects grow methods that delegate to >> shutil. That'd avoid duplicating logic eg for rmtree and copyfile. > > > shutil already supports Path object

[Python-ideas] Re: pathlib enhancements

2020-11-22 Thread Todd
On Sun, Nov 22, 2020 at 5:46 PM Chris Angelico wrote: > On Mon, Nov 23, 2020 at 6:54 AM Todd wrote: > > > > I know enhancements to pathlib gets brought up occasionally, but it > doesn't look like anyone has been willing to take the initiative and see > things through to completion. I am willing

[Python-ideas] Re: pathlib enhancements

2020-11-22 Thread Chris Angelico
On Mon, Nov 23, 2020 at 6:54 AM Todd wrote: > > I know enhancements to pathlib gets brought up occasionally, but it doesn't > look like anyone has been willing to take the initiative and see things > through to completion. I am willing to keep the ball rolling here and even > implement these m

[Python-ideas] Re: pathlib enhancements

2020-11-22 Thread Todd
On Sun, Nov 22, 2020 at 3:27 PM Abdulla Al Kathiri < alkathiri.abdu...@gmail.com> wrote: > On Nov 22, 2020, at 11:53 PM, Todd wrote: > > I know enhancements to pathlib gets brought up occasionally, but it > doesn't look like anyone has been willing to take the initiative and see > things through

[Python-ideas] Re: pathlib enhancements

2020-11-22 Thread Abdulla Al Kathiri
I really like these ideas. Effectively, we can use pathlib.Path without ever needing to import shutil. We would like also copyfile from shutil if we are only interested copying the file data. How about adding append_text and append_bytes with newLine similar to what you suggested? > On Nov 22,