Message321135
The SyntaxError is not relevant. Interactive CPython:
>>> d=[]
>>> d=()
>>> d={}
>>>
Erroneous extra lines in IDLE 3.6+ Shell but not editor:
>>> d = []
>>> d=()
>>> d={}
>>> d=[i for i in [1]]
>>>
The 'blank' lines are indents produced by IDLE's smart indent mechanism, which is trigger by keying '\n', *before* the code is tentatively compiled.
While the extra lines are an error for the examples above, they are arguably correct for your example, where there is no closing '}'. The indenter treats it the same as if there were a closing quote, as in the following, which *is* the same in shell and editor, and correct.
d = {1: 'one}'
# Indent lines up next dict item with the one above.
Even though your example is no a bug, it lead me to discover a regression in current 3.6+. In the past year, there have been a couple of patches that touched the autoindent code. |
|
Date |
User |
Action |
Args |
2018-07-05 21:58:25 | terry.reedy | set | recipients:
+ terry.reedy, grantjenks |
2018-07-05 21:58:25 | terry.reedy | set | messageid: <1530827905.59.0.56676864532.issue34055@psf.upfronthosting.co.za> |
2018-07-05 21:58:25 | terry.reedy | link | issue34055 messages |
2018-07-05 21:58:25 | terry.reedy | create | |
|