> On 17 Mar 2018, at 22:49, George Fischhof <geo...@fischhof.hu> wrote: > > > > 2018. márc. 17. 21:34 ezt írta ("Barry" <ba...@barrys-emacs.org>): > > >> On 17 Mar 2018, at 10:42, George Fischhof <geo...@fischhof.hu> wrote: >> >> Hi folks, >> >> I added the list of functions to the proposal, here is the new version. >> >> George >> >> >> >> >> PEP: 9999 >> Title: Pathlib Module Should Contain All File Operations >> Author: George Fischhof <george at fischhof.hu> >> Status: Draft >> Type: Standards Track >> Content-Type: text/x-rst >> Created: 15-Mar-2018 >> Python-Version: 3.8 >> Post-History: 12-Mar-2018, 17-Mar-2018 >> >> >> Abstract >> ======== >> >> This PEP proposes pathlib module to be a centralized place for all >> file-system related operations. >> >> >> Rationale >> ========= >> >> Right now we have several modules that contain functions related >> to file-system operations mainly the os, pathlib and shutil. >> For beginners it is quite hard to remember where can he / she find >> a function (copy resides in shutil, but the remove function can be >> found in the os module. (And sometimes developers with moderate >> experience have to check the documentation as well.) >> >> After the release of version 3.6 several methods became aware of >> path-like object. There are only a few ones which does not support >> the path-like object. After making these methods path-like object >> aware, these functions could be added to pathlib. >> >> With functions in pathlib the developers should not have to think >> on which method (function) can be found in which module. >> >> Makes the life easier. >> >> >> Implementation >> ============== >> >> For compatibility reasons the pathlib should contain wrappers to >> the original functions. The original functions should remain >> at their original place. (Or if pathlib contains the function, the >> original modules should have a wrapper to it.) >> >> >> List of mentioned functions >> =========================== >> >> * os.link => path.hardlink_to >> (should be named similarly to path.softlink_to) >> >> * os.mkfifo >> >> * os.readlink >> >> * os.remove >> >> * os.removedirs >> (shutil.rmtree has the same functionalaty) > > I think you will find these to are a lot different. > > > From high level, it is only question of implementation: the main goal is to > remove a chain of directories
This is a PEP you and proposing details matter and this is one of the details tha you need be clear on. > >> >> * os.truncate >> >> * shutil.copyfileobj > > This function does not take paths as arguments. I guess it does not belong > here. > > > No path, it is true (right now), but it has sense to have this function among > the others. What do you mena right now? > > >> >> * shutil.copyfile >> >> * shutil.copymode >> >> * shutil.copystat >> >> * shutil.copy >> >> * shutil.copy2 >> >> * shutil.copytree with shutil.ignore_patterns >> >> * shutil.move >> >> * shutil.disk_usage >> >> * shutil.chown > > Is yout plan to also expose all the constants need to use chmod etc from > pathlib? > > Of course, because this PEP is about conveniece and easyness. Can you say so then and not leave it in doubt. > >> >> All functions from os module accept path-like objects, >> and none of the shutil functions. > > Should shutils be improved to accept path-like first? > > Maybe. The PEP should show the goal. This is just a task among others to > achieve the goal. But it can be done simultanuosly. > > George > > Barry > >> >> >> Copyright >> ========= >> >> This document has been placed in the public domain. >> >> >> >> .. >> Local Variables: >> mode: indented-text >> indent-tabs-mode: nil >> sentence-end-double-space: t >> fill-column: 70 >> coding: utf-8 >> End: >> >> >> >> >> _______________________________________________ >> Python-ideas mailing list >> Python-ideas@python.org >> https://mail.python.org/mailman/listinfo/python-ideas >> Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/