[issue37791] Propose to deprecate `ignore_errors` and `onerror` parameters of `shutil.rmtree()`

Marco Sulla report at bugs.python.org
Thu Aug 8 04:35:36 EDT 2019


New submission from Marco Sulla <launchpad.net at marco.sulla.e4ward.com>:

I propose to mark as deprecated the parameters `ignore_errors` and `onerror` of `shutil.rmtree()`, and raise a warning if used.

The reason is I feel them unpythonic. For emulating `ignore_errors=True`, the code can be written simply with a `try-except` that passes by default all `OSError`s . The `ignore_errors=True, onerror=myHandler` case can written simply with a `try-except` that handles `OSError`s. And in the handle can be code or a call to an handler with the same paramaters `myHandler` accept.

----------
components: +Library (Lib)
title: Propose to deprecate ignore_errors, -> Propose to deprecate `ignore_errors` and `onerror` parameters of `shutil.rmtree()`
type:  -> enhancement
versions: +Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37791>
_______________________________________


More information about the Python-bugs-list mailing list