[Python-ideas] SyntaxWarning for for/while/else without break or return?

Steven D'Aprano steve at pearwood.info
Sun Oct 11 12:01:05 CEST 2009

On Sun, 11 Oct 2009 03:36:45 pm Stephen J. Turnbull wrote:
> Steven D'Aprano writes:
>  > I don't believe the language should be hand-holding the naive user
>  > to that extent. What do we do, fill the compiler up with a
>  > thousand warnings for things which might confuse some naive user?
> Nobody (except you and Gerald) is talking about things that "might"
> confuse "some naive user", nor does anybody advocate proliferating
> warnings or even getting within a light-year of that slippery slope.
> We're talking about one construct that *demonstrably* confuses
> *people who have taken it upon themselves to explain correct usage in
> this thread*, including at least one who considers himself above
> needing such warnings. 

With all respect to those people, just because somebody takes it upon 
themselves to explain correct usage, doesn't mean they know the 
correct usage. This isn't meant as a dig at anyone here, but sadly the 
least competent people tend to be the most sure of themselves:


To quote Charles Darwin: "ignorance more frequently begets confidence 
than does knowledge".

I don't exclude myself in this -- we all make mistakes, and those who 
are on comp.lang.python may have noticed me make a clanger just 

Nobody here has demonstrated that for...else is a significant problem. 
I'd describe it as a gotcha, and Python, like every computer language, 
has a number of gotchas. There's no need have the compiler defensively 
warn people about them.

> We're talking about a single construct that 
> the BDFL has deigned to deprecate as an unfortunate choice of
> keywords.
> Please stop wandering off topic, and address the arguments that have
> been presented.

You're kidding, right? Or is anything but acquiescence to the idea of 
giving a warning "off-topic"? Just because somebody proposes a change, 
doesn't mean that opposition to that change is off-topic.

Steven D'Aprano

More information about the Python-ideas mailing list