(original) (raw)

On 6 November 2017 at 13:05, Nick Coghlan <ncoghlan@gmail.com> wrote:
As part of this though, I'd suggest amending the documentation for
DeprecationWarning \[1\] to specifically cover how to turn it off
programmatically (\`warnings.simplefilter("ignore",
DeprecationWarning)\`), at the command line (\`python -W
ignore::DeprecationWarning ...\`), and via the environment
(\`PYTHONWARNINGS=ignore::DeprecationWarning\`).

I'm wondering if it would be sensible to recommend only disabling the warnings if running with a known version of Python e.g.

if sys.version\_info < (3, 8):
with warnings.simplefilter('ignore', DeprecationWarning):
import module

The idea here is to prompt the developer to refactor to not use the deprecated functionality early enough that users aren't impacted.

Tim Delaney