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@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