[Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement
francismb
francismb at email.de
Mon Feb 8 13:00:49 EST 2016
More information about the Python-Dev mailing list
Mon Feb 8 13:00:49 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 ]
Hi, On 02/08/2016 06:44 PM, Victor Stinner wrote: > Hi, > > I changed the Python compiler to ignore any kind "constant > expressions", whereas it only ignored strings and integers before: > http://bugs.python.org/issue26204 > > The compiler now also emits a SyntaxWarning on such case. IMHO the > warning can help to detect bugs for developers who just learnt Python. > [...] > New behaviour: > > haypo at smithers$ ./python > Python 3.6.0a0 (default:759a975e1230, Feb 8 2016, 18:21:23) >>>> def f(): > ... False > ... > <stdin>:2: SyntaxWarning: ignore constant statement > Just for my understanding: What would happen if someone has functions where some return constant expressions and others not and then that functions are used depending on some other context. E.g: def behaviour2(ctx): return 1 def behaviour1(ctx): return some_calculation_with(ctx) [...] if ... : return behaviour1(ctx) else : return behaviour2() Is that going to raise a warning? Thanks in advance! francis
- 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 ]
More information about the Python-Dev mailing list