[Python-ideas] Promoting the adoption of pathlib [Was: Working with Path objects: p-strings?]

Michel Desmoulin desmoulinmichel at gmail.com
Thu Mar 31 15:52:33 EDT 2016


Le 31/03/2016 19:36, Alexander Walters a écrit :
> 
> 
> On 3/31/2016 13:32, Ethan Furman wrote:
>> On 03/31/2016 10:27 AM, Alexander Walters wrote:
>>
>>> I think this is missing step zero.  What does pathlib even offer me, the
>>> library developer?  Why should I use it?  I cannot be the only person
>>> who does not understand why it exists, let alone why I should be using
>>> it in my libraries.
>>
>> Easier path manipulations.
> 
> Are path manipulations hard?  I have never run into anything that I
> couldn't solve trivially with os.path.  Is this really all this is for?

Slicing is not hard.

But we like listing[a:b] better than slice(listing, a, b).

Decorating is not hard.

But we like @decorator better than func = decorator(func)

Try/except is not hard, but we like dict.get('foo', default) better than
user KeyError.

Path are not hard, but I like better (p / 'foo').absolute() than
os.path.realpath(os.path.join(p, 'foo')). I like not having to know if I
need to import to look for something in glop, shutils, open or os just
for my quick ipython session.

Your program is the sum of its parts, and every time you make something
a tiny bit clearer, cleaner, easier to use and read, it's a win.

Python is fantastic, because it's full of small details making your
program simple and easy to write, while clear to read.

The FS manipulation API is showing it's age, people are using
alternatives from pypi because they like it better, it's been notice and
pathlib has been integrated in 3.5.

Now pathlib needs improving. But it's here.

> 
>>
>> A better user experience for those users that use pathlib.
> 
> In my experience, a rounding error of users.
> 
>>
>> Much pain on your part until the stdlib fully supports pathlib.Paths.
> 
> Considering my last two counterpoints, this is likely to kill any
> motivation to use the library.
> 
> If you want to promote pathlib use, really sell pathlib's benefits. the
> patches to the standard library will come later if people actually want
> to use it.
> 
>>
>> -- 
>> ~Ethan~
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
> 
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/


More information about the Python-ideas mailing list