Message316511
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. |
|
Date |
User |
Action |
Args |
2018-05-14 14:30:35 | Aaron Hall | set | recipients:
+ Aaron Hall |
2018-05-14 14:30:35 | Aaron Hall | set | messageid: <1526308235.34.0.682650639539.issue33498@psf.upfronthosting.co.za> |
2018-05-14 14:30:35 | Aaron Hall | link | issue33498 messages |
2018-05-14 14:30:35 | Aaron Hall | create | |
|