3 ms·
Thank you for pointing that out. I meant to show that while they both store their inputs and outputs in array-like structures, Mathematica does it in a way that
by nswanberg 13y ago
Thank you for pointing that out. I meant to show that while they both store their inputs and outputs in array-like structures, Mathematica does it in a way that is valid in its own syntax, and IPython does not.
In Mathematica "In[1]:= 1+2" is a syntactially valid expression (though the literal In symbol is protected), so you could do the following:
In[1]:= in[1]:= 1+2
and the interpreter would evaluate it (though the values of In[1] and in[1] would be different).
But even with all of the symbols defined, this is not valid Python (according to https://www.pythonanywhere.com/try-ipython/ https://www.pythonanywhere.com/try-ipython/):
In [1]: in=[]
In [2]: in[0]:1+2
File "<ipython-input-2-b9cd4c9ee15d>", line 1
in[0]:1+2
^
SyntaxError: invalid syntax
The fact that this trivial expression is valid in Mathematica and not in IPython by itself says nothing about the relative merits of each system. IPython could be modified to use another notation for the input/output arrays, and Mathematica would work just as well if it were changed to use some syntactically incorrect notation. But what I was attempting to show is an example of how consistent Mathematica is.