On 02/08/2016 10:00 AM, francismb wrote: > On 02/08/2016 06:44 PM, Victor Stinner wrote: >> 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? No, because those constants are being used (returned). Only constants that aren't used at all get omitted. -- ~Ethan~
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4