[Python-ideas] pathlib suggestions

Thomas Kluyver thomas at kluyver.me.uk
Wed Jan 25 10:45:31 EST 2017


On Wed, Jan 25, 2017, at 03:33 PM, Todd wrote:

> On Wed, Jan 25, 2017 at 10:18 AM, Petr Viktorin
> <encukou at gmail.com> 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
>>  answers you want.
> 

> 

> I wouldn't use it in that situation. 



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 and write buggy code using it. And I can't currently
think of a general example where it would be useful.


I thought about suggesting a 'hassuffix' method, but it doesn't pass the
'one way to do it' test when you can do:


p.name.endswith('.tar.gz')


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170125/375c0669/attachment.html>


More information about the Python-ideas mailing list