On 25 August 2016 at 23:14, Victor Stinner <[email protected]> wrote: > Maybe add a different function rather add a flag? Something like > shutil.remove_dir_files().
The typical Python term for the concept would be "clear", giving shutil.clear_dir(). Like the ".clear()" method on containers, it would delete the contents, but leave the container itself alone. rmtree() could then be a thin wrapper around clear_dir() that also deletes the base directory. Alternatively, if we wanted to stick with the "rm" prefix, we could use "shutil.rmcontents()" as the name. The main downside I'd see to that is that I'd half expect it to work on files as well (truncating them to a length of zero), while clear_dir() is unambiguous. Cheers, Nick. -- Nick Coghlan | [email protected] | Brisbane, Australia _______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
