[Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations

George Fischhof george at fischhof.hu
Sun Mar 18 07:14:04 EDT 2018


2018-03-18 9:05 GMT+01:00 Nick Coghlan <ncoghlan at gmail.com>:

> On 16 March 2018 at 03:15, Chris Angelico <rosuav at gmail.com> wrote:
>
>> On Fri, Mar 16, 2018 at 12:38 AM, George Fischhof <george at fischhof.hu>
>> wrote:
>> >
>> >
>> > " if new file functions are added, they will go only in pathlib,
>> >   which makes pathlib effectively mandatory;"
>> > Yes but I think this part of the evolution: slowly everyone will shift
>> to
>> > pathlib,
>> > and being mandatory is true for the current status as well: if you need
>> a
>> > function, you need the module.
>> > Right now if you wan to execute some file operations, you need os plus
>> > shutil, because the half of the
>> > functions are in one of them, the other half is in the other module
>>
>> The os module is cheap; pathlib has a definite cost. If every file
>> operation goes through pathlib
>
>
> Keep in mind that the `os` layer will never go away: `pathlib` still needs
> a lower level API to call to *do the work* of actually interacting with the
> underlying operating system APIs (e.g. this is why we added os.scandir).
>
> A similar situation applies when it comes to glob, fnmatch, etc.
>
> Even `shutil` will likely retain its place as a lower level procedural API
> behind pathlib's object-oriented facade, since raw strings are still
> frequently going to be easier to work with when mixing and matching Python
> code and native operating system shell code.
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
>
> _______________________________________________
> 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/
>
>

:-)
+ 1

George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180318/7db000da/attachment-0001.html>


More information about the Python-ideas mailing list