On Wed, Jan 25, 2017, at 03:33 PM, Todd wrote:
> On Wed, Jan 25, 2017 at 10:18 AM, Petr Viktorin
> <[email protected]> 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')
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/