[Python-ideas] pathlib suggestions
Todd
toddrjen at gmail.com
Wed Jan 25 10:58:29 EST 2017
On Wed, Jan 25, 2017 at 10:45 AM, Thomas Kluyver <thomas at kluyver.me.uk>
wrote:
> 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.
>
>From my perspective at least, those arguments apply just as well to the
existing "suffix" and "stem" properties.
>
> 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')
>
Then why is there a "match" method? It doesn't seem like the "one way to
do it test" is being used for pathlib, nor do I think it really applies for
a module whose whole point is to provide convenience tools.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170125/a02406d4/attachment.html>
More information about the Python-ideas
mailing list