[Python-Dev] Catching "return" and "return expr" at compile time

Tim Peters tim_one@email.msn.com
Tue, 7 Sep 1999 14:26:30 -0400


[Guido]
> ...
> I'm wondering if we should introduce a general '-w' flag to turn on
> warnings like this (which would subsume -t)?  Or perhaps there should
> be a -W flag ("no warnings") and warnings should be the default?

The latter, if for no other reason than that new users should get bludgeoned
into good practice from their first day.  If something's serious enough to
trigger a warning, and you insist on doing it anyway, then you should at
least know enough about Python to be able to find the -W switch <wink>.

Note that in response to 1,379 distinct complaints about insane Perl
semantics, TomC's stock answer is that every serious Perl programmer runs
with -w and "use strict".  He's right!  Every serious Perl programmer does.
Perl picked the wrong default, letting naive programmers hang themselves
1,379 distinct ways by default.

Besides, warning by default will enhance your enviable reputation as a
ruthless dictator opposed to freedom and creativity <wink>.

> There are also platform problems, e.g. on the Mac, stderr doesn't
> always exist, and on Windows, it doesn't exist if pythonw.exe is
> used...

But this is already a problem for, e.g., reporting fatal syntax errors, yes?
That is, -w/-W isn't creating a new problem here, it's making the lack of a
solution to an old problem more evident.

all's-for-the-best-in-this-best-of-all-possible-worlds-ly y'rs  - tim