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

Gerald Britton gerald.britton at gmail.com
Sat Oct 10 01:04:32 CEST 2009

Well I guess you can read the post how you like.  Based on the way
Python works today, I'm sure you won't get a warning for people
failing to read the documentation.  In fact, Python issues few
warnings at all, ever where many other compilers do.  Without a
significant change in philosophy, it never will.  OTOH if Python did
start warnings, I'd most like to see warnings for things like:

1. variables assigned but never read
2. dead code (like if False: do_something())
3. meaningless code (like x = True or False or x == True or False)
4. try/except without any exceptions to catch
5. unused imports

Still, I think the best place for these is pylint.

More information about the Python-ideas mailing list