This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Aaron Hall
Recipients Aaron Hall, serhiy.storchaka
Date 2018-05-15.16:08:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526400489.8.0.682650639539.issue33498@psf.upfronthosting.co.za>
In-reply-to
Content
> What is wrong with just using shutil.rmtree()?

0. It's awkward to import just for demonstrations.
1. It's harder for new pythonists to discover.
2. A method provides discoverability in an object's namespace.
3. rmtree is a method of paths (typical usage is rmtree(path)).
4. rmtree is clearly functionality that is missing from the Path object (which has effectively rm, rm -d, but not rm -r).

> You can't deal with files with only using pathlib. You can't read ZIP archives, open temporary files, import modules, download files from Internet and open them in the webbrowser, run subprocesses, send files by e-mail, determine the MIME type of files, read WAV files with only using pathlib.

I wasn't suggesting those things. After some thought, I would probably not support those things to be in pathlib either. Maybe they are "file" methods, but to me, they are not semantically "path" methods. That functionality is in much more specialized domain-oriented modules, and easy to discover. 

We need a recursive rmdir so that users aren't tempted to roll their own - and wind up deleting symlinked things.

I *would* support some of those other shutil functions to become Path methods, perhaps move, copy2, and copytree, as they *are* path methods (you just need to supply another destination path), but I'm not finding it to be a pain point yet.
History
Date User Action Args
2018-05-15 16:08:09Aaron Hallsetrecipients: + Aaron Hall, serhiy.storchaka
2018-05-15 16:08:09Aaron Hallsetmessageid: <1526400489.8.0.682650639539.issue33498@psf.upfronthosting.co.za>
2018-05-15 16:08:09Aaron Halllinkissue33498 messages
2018-05-15 16:08:09Aaron Hallcreate