[Python-ideas] Displaying DeprecationWarnings in the interactive interpreter, second try
Nick Coghlan
ncoghlan at gmail.com
Thu May 28 04:53:23 CEST 2015
On 28 May 2015 at 10:29, Nathaniel Smith <njs at pobox.com> wrote:
> Hi all,
>
> I'm tired of getting bug reports like this one:
>
> https://github.com/numpy/numpy/issues/5919
>
> where the issue is just that the user didn't see deprecation warnings,
> so I just filed a bug report requesting that the interactive Python
> REPL start printing DeprecationWarnings when users use deprecated
> functionality:
>
> https://bugs.python.org/issue24294
+1 from me. For folks that aren't aware of the history, prior to
Python 2.7, the situation was like this (DW = DeprecationWarning, PDW
= PendingDeprecationWarning):
Test frameworks: DW visible by default, PDW hidden by default
Interactive REPL: DW visible by default, PDW hidden by default
Non-interactive execution: DW visible by default, PDW hidden by default
In Python 2.7, this behaviour was changed to be as follows:
Test frameworks: both visible by default
Interactive REPL: both hidden by default
Non-interactive execution: both hidden by default
This eliminated deprecation warnings from the experience of end users
running scripts and applications that merely happened to be written in
Python, but also eliminated any real behavioural difference between DW
and PDW, making it very unclear as to whether or not retaining PDW
still had any practical purpose beyond backwards compatibility.
In addition to better alerting end users to genuinely imminent
deprecations that they should adapt to ASAP, splitting them again in
the interactive REPL case would restore a meaningful behavioural
difference that can help pragmatically guide decisions as to which is
more appropriate to use for a given deprecation:
Test frameworks: both visible by default
Interactive REPL: DW visible by default, PDW hidden by default
Non-interactive execution: both hidden by default
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list