Message408651
At some point in 3.9 Python appears to have stopped accepting source that starts with an indent, then a '\', then the indented statement. From the lexical analysis [1] "Indentation cannot be split over multiple physical lines using backslashes; the whitespace up to the first backslash determines the indentation."
Running the attached program under 3.8.12 I get:
```
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
```
But running under 3.10.0 I get:
```
File "/Users/jeremyp/tmp/nodent.py", line 3
"""Print a Fibonacci series up to n."""
^
IndentationError: expected an indented block after function definition on line 1
```
Running under 3.9.9 also gives an IndentationError, both with and without -X oldparser. So this doesn't seem directly related to the new parser, but seems likely it is fall out from the general grammar restructuring.
IMHO it isn't a particularly nice feature for the language to have. Especially since not all lines like ' \' behave the same. But it was there and documented for many years, so should probably be put back. Does a core developer agree? That the implementation is not following the spec?
[1]: https://docs.python.org/3/reference/lexical_analysis.html#indentation |
|
Date |
User |
Action |
Args |
2021-12-15 23:06:30 | ucodery | set | recipients:
+ ucodery, lys.nikolaou, pablogsal |
2021-12-15 23:06:30 | ucodery | set | messageid: <1639609590.75.0.562177749036.issue46091@roundup.psfhosted.org> |
2021-12-15 23:06:30 | ucodery | link | issue46091 messages |
2021-12-15 23:06:30 | ucodery | create | |
|