OS related file operations (copy, move, delete, rename...) should be placed into one module
Hi There, OS related file operations (copy, move, delete, rename...) should be placed into one module... As it quite confusing that they are in two moduls (os and shutil). I have read that one is higher level than other, but actually to use them I have to think which function can be found in which module. It is confuse for beginners, and makes the usage more complex instead of make it more simple (as Zen of Python says ;-) ) An alias could good, not to cause incompatibility. Best regards, George
Hi George, While the old “let’s treat strings as paths” modules are split up like you said, pathlib can do what they do and more: https://docs.python.org/3/library/pathlib.html It’s also prettier and easier to use, especially when using autocompletion (just type “path.is<tab>” and see what you can test the path for) Best, Philipp George Fischhof <george@fischhof.hu> schrieb am Do., 12. Jan. 2017 um 10:06 Uhr:
Hi There,
OS related file operations (copy, move, delete, rename...) should be placed into one module... As it quite confusing that they are in two moduls (os and shutil).
I have read that one is higher level than other, but actually to use them I have to think which function can be found in which module.
It is confuse for beginners, and makes the usage more complex instead of make it more simple (as Zen of Python says ;-) )
An alias could good, not to cause incompatibility.
Best regards, George _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
I agree that this has been a bit of a wart for a long time. While the old “let’s treat strings as paths” modules are split up like you said, pathlib can do what they do and more: https://docs.python.org/3/library/pathlib.html Exactly -- this is The Solution. It combines paths themselves with things you are likely to do with paths. It may well lack some nice features. If so, suggestions for that would be the way to go. The usefulness of pathlib has been hampered by the fact that path objects couldn't be used in many stdlib functions. However, that has been remedied in 3.6: - A new file system path protocol <https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-pep519> has been implemented to support path-like objects <https://docs.python.org/3/glossary.html#term-path-like-object>. All standard library functions operating on paths have been updated to work with the new protocol. So we have a nice way forward. -CHB It’s also prettier and easier to use, especially when using autocompletion (just type “path.is<tab>” and see what you can test the path for) Best, Philipp George Fischhof <george@fischhof.hu> schrieb am Do., 12. Jan. 2017 um 10:06 Uhr:
Hi There,
OS related file operations (copy, move, delete, rename...) should be placed into one module... As it quite confusing that they are in two moduls (os and shutil).
I have read that one is higher level than other, but actually to use them I have to think which function can be found in which module.
It is confuse for beginners, and makes the usage more complex instead of make it more simple (as Zen of Python says ;-) )
An alias could good, not to cause incompatibility.
Best regards, George _______________________________________________ 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/
On Thu, Jan 12, 2017 at 11:17 AM, Chris Barker - NOAA Federal < chris.barker@noaa.gov> wrote:
I agree that this has been a bit of a wart for a long time.
While the old “let’s treat strings as paths” modules are split up like you said, pathlib can do what they do and more: https://docs.python.org/ 3/library/pathlib.html
Exactly -- this is The Solution. It combines paths themselves with things you are likely to do with paths.
It may well lack some nice features. If so, suggestions for that would be the way to go.
Can such suggestions go here or should someone start a new thread?
On 1/12/2017 2:11 PM, Todd wrote:
On Thu, Jan 12, 2017 at 11:17 AM, Chris Barker - NOAA Federal <chris.barker@noaa.gov <mailto:chris.barker@noaa.gov>> wrote:
I agree that this has been a bit of a wart for a long time.
While the old “let’s treat strings as paths” modules are split up like you said, pathlib can do what they do and more: https://docs.python.org/3/library/pathlib.html <https://docs.python.org/3/library/pathlib.html>
Exactly -- this is The Solution. It combines paths themselves with things you are likely to do with paths.
It may well lack some nice features. If so, suggestions for that would be the way to go.
Can such suggestions go here or should someone start a new thread?
Start a new thread for 'Add x to pathlib'. -- Terry Jan Reedy
2017-01-12 20:11 GMT+01:00 Todd <toddrjen@gmail.com>:
On Thu, Jan 12, 2017 at 11:17 AM, Chris Barker - NOAA Federal < chris.barker@noaa.gov> wrote:
I agree that this has been a bit of a wart for a long time.
While the old “let’s treat strings as paths” modules are split up like you said, pathlib can do what they do and more: https://docs.python.org/ 3/library/pathlib.html
Exactly -- this is The Solution. It combines paths themselves with things you are likely to do with paths.
It may well lack some nice features. If so, suggestions for that would be the way to go.
Can such suggestions go here or should someone start a new thread?
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
Hi Guys, I just would like to ask You whehet there is a step forward in this topic? BR, George
participants (5)
-
Chris Barker - NOAA Federal
-
George Fischhof
-
Philipp A.
-
Terry Reedy
-
Todd