[Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement (original) (raw)
Victor Stinner victor.stinner at gmail.com
Tue Feb 9 05:06:43 EST 2016
- Previous message (by thread): [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement
- Next message (by thread): [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2016-02-09 10:57 GMT+01:00 Joseph Martinot-Lagarde <contrebasse at gmail.com>:
I frequently use 1/0 as a quick break in a script or a program (it's even more useful with post-mortem debugging). Would it be considered as a constant and ignored instead of raising a ZeroDivisionError ?
"self.x - self.y" and "1/0" are not removed since they have side effects.
Right now, "(1, 2, 3)" is not removed. But later we may remove it, since it has no side effect, it's a constant statement.
Note: We are talking about statements. 1 is not removed in "lambda: 1" which is a valid expression ;-)
Victor
- Previous message (by thread): [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement
- Next message (by thread): [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]