Re: REPL peculiarity

2021-03-11 Thread Alan Gauld via Python-list
On 11/03/2021 11:01, Rob Cliffe via Python-list wrote: > This is a valid Python program: > > def f(): pass > print(f) > > But at the REPL: > > >>> def f(): pass > ... print(f) >   File "", line 2 >     print(f) >     ^ > SyntaxError: invalid syntax > > It doesn't seem to matter what the sec

Re: REPL peculiarity

2021-03-11 Thread Terry Reedy
On 3/11/2021 6:01 AM, Rob Cliffe via Python-list wrote: This is a valid Python program: def f(): pass print(f) But at the REPL: >>> def f(): pass ... print(f)   File "", line 2     print(f)     ^ SyntaxError: invalid syntax It doesn't seem to matter what the second line is.  In the REPL y

REPL peculiarity

2021-03-11 Thread Rob Cliffe via Python-list
This is a valid Python program: def f(): pass print(f) But at the REPL: >>> def f(): pass ... print(f)   File "", line 2     print(f)     ^ SyntaxError: invalid syntax It doesn't seem to matter what the second line is.  In the REPL you have to leave a blank line after the "def" line.  Why? T