New submission from Aaron Hall <aaronch...@yahoo.com>:

pathlib.Path wants the rmtree method from shutil

I think we need this method for a couple of reasons.

1. in shell, rm has the -r flag - In Python, we use shutil.rmtree as a best 
practice for this.

2. I prefer to teach my students about pathlib.Path as opposed to other ways of 
dealing with files. It's a great abstraction. But it's somewhat leaky, 
especially when it comes to recursively deleting a directory with its contents, 
as I now need to import rmtree from shutil.

Perhaps we need this as a method in the abstract base class that recursively 
uses the methods provided by the concrete implementations. I can look at the 
rmtree method for a reference implementation. 

Perhaps we should just give Path.rmdir a default recursive argument? Default 
would be False, of course, to retain current behavior.

----------
components: Library (Lib)
messages: 316511
nosy: Aaron Hall
priority: normal
severity: normal
status: open
title: pathlib.Path wants an rmtree method
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33498>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to