I'm trying to define a simple function. The functions below are exact copies from my .py-file.
This works fine (1):
def test_fun(A,B): return A*B
But this does not work (2) (I run it by highlighting the entire function in my .py-file and running it in the visual studio interactive window (so not in the terminal)):
def test_fun(
A,B
):
return A*B
It gives me
>>> def test_fun(
File "<stdin>", line 1
def test_fun(
^
SyntaxError: unexpected EOF while parsing
>>> A,B
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'A' is not defined
>>> ):
File "<stdin>", line 1
):
^
SyntaxError: invalid syntax
>>> return A*B
File "<stdin>", line 1
SyntaxError: 'return' outside function
Why is that way of defining the function failing?
If I only run the first line of (2):
def test_fun(
I get the same error (that is, I don't get ...
):
>>> def test_fun(
File "<stdin>", line 1
def test_fun(
^
SyntaxError: unexpected EOF while parsing
Here I would expect it to give me ...
.
And to my suprise, this function below actually works (3):
def test_fun(
A,B):
return A*B
All my functions are defined as the (2) and they worked fine in visual studio 2017 ver. 15.5.3. I just updated to visual studio 2017 ver. 15.7.5. and now the error occurs. Does anyone know what is happening?
I'm using python 3.6.
Note that I'm not using Iphyton interactive mode. If I enable it (2) actually works.