On Wed, Jan 25, 2017, at 03:58 PM, Todd wrote:
> On Wed, Jan 25, 2017 at 10:45 AM, Thomas Kluyver
> <[email protected]> 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 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.
To some extent it does. But the convention of looking at a single
extension is common enough that there's a stronger case for providing
easy access to that.
> 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.
Everything is trade-offs: if you can justify why a new thing is useful
enough, that can override the 'one way to do it' consideration. That's
why we now have four kinds of string formatting. But I don't think 'X
got away with it so we should allow Y too' is a compelling argument.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/