Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Todd
On Wed, Jan 25, 2017 at 11:16 AM, Petr Viktorin wrote: > On 01/25/2017 04:33 PM, Todd wrote: > >> On Wed, Jan 25, 2017 at 10:18 AM, Petr Viktorin > > wrote: >> >> On 01/25/2017 04:04 PM, Todd wrote: >> >> On Wed, Jan

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Steve Dower
On 25Jan2017 0816, Petr Viktorin wrote: On 01/25/2017 04:33 PM, Todd wrote: But what if the .tar.gz file is called "spam-4.2.5-final.tar.gz"? Existing tools like glob and endswith() can deal with the ".tar.gz" extension reliably, but "fullsuffix" would, arguably, not give the

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Todd
On Wed, Jan 25, 2017 at 11:04 AM, Thomas Kluyver wrote: > On Wed, Jan 25, 2017, at 03:54 PM, Todd wrote: > > Those [.tar.foo] are just examples that I encounter a lot, there can be > other cases where multiple extensions are used. > > > The real issue is that there's no

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Thomas Kluyver
On Wed, Jan 25, 2017, at 03:58 PM, Todd wrote: > On Wed, Jan 25, 2017 at 10:45 AM, Thomas Kluyver > wrote: >> __You might not, but it seems like an attractive nuisance. You can't >> reliably use it as a test for .tar.gz files, but it would be easy to >> think that you can

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Paul Moore
On 25 January 2017 at 16:04, Thomas Kluyver wrote: > On Wed, Jan 25, 2017, at 03:54 PM, Todd wrote: > > Those [.tar.foo] are just examples that I encounter a lot, there can be > other cases where multiple extensions are used. > > > The real issue is that there's no

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Thomas Kluyver
On Wed, Jan 25, 2017, at 03:54 PM, Todd wrote: > Those [.tar.foo] are just examples that I encounter a lot, there can > be other cases where multiple extensions are used. The real issue is that there's no definition of what an extension is. You can have dots anywhere in a filename, and it's not

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Todd
On Wed, Jan 25, 2017 at 10:45 AM, Stephan Houben wrote: > Hi all, > > It seems to me that the correct algorithm to get the "full suffix" is not > to take everything after the FIRST dot, > but rather to: > 1. Recognize that the last suffix is one of the UNIX-style

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Todd
On Wed, Jan 25, 2017 at 10:45 AM, Thomas Kluyver wrote: > On Wed, Jan 25, 2017, at 03:33 PM, Todd wrote: > > On Wed, Jan 25, 2017 at 10:18 AM, Petr Viktorin wrote: > > But what if the .tar.gz file is called "spam-4.2.5-final.tar.gz"? > Existing tools

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Stephan Houben
Hi all, It seems to me that the correct algorithm to get the "full suffix" is not to take everything after the FIRST dot, but rather to: 1. Recognize that the last suffix is one of the UNIX-style compression tools .Z, .gz, ,bz2, .xz, .lzma (at least) 2. Then add the next-to-last suffix. So we

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Thomas Kluyver
On Wed, Jan 25, 2017, at 03:33 PM, Todd wrote: > On Wed, Jan 25, 2017 at 10:18 AM, Petr Viktorin > wrote: >> But what if the .tar.gz file is called "spam-4.2.5-final.tar.gz"? >> Existing tools like glob and endswith() can deal with the ".tar.gz" >> extension reliably, but

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Todd
On Wed, Jan 25, 2017 at 10:18 AM, Petr Viktorin wrote: > On 01/25/2017 04:04 PM, Todd wrote: > >> On Wed, Jan 25, 2017 at 12:25 AM, Stephen J. Turnbull >> > > wrote: >> >> I'm just going to

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Petr Viktorin
On 01/25/2017 04:04 PM, Todd wrote: On Wed, Jan 25, 2017 at 12:25 AM, Stephen J. Turnbull > wrote: I'm just going to let fly with the +1s and -1s, don't take them too seriously, they're basically

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Todd
On Wed, Jan 25, 2017 at 12:25 AM, Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > I'm just going to let fly with the +1s and -1s, don't take them too > seriously, they're basically impressionistic (I'm not a huge user of > pathlib yet). > > Todd writes: > > > So although the

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Ed Kellett
On Wed, 25 Jan 2017 at 05:26 Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > -1 I don't see how this is an improvement. If it would raise if > exist_ok == False, then > > try: > p.rename(another_p, exist_ok=False) > except ExistNotOKError: >