Issue
If I do:
_j = 1
print(_j)
1
This is as expected
But if I:
_i = 1
print(_i)
_i = 1
Not at all what I expected. Why is _i
special and what other names have this property that I cannot overwrite it?
Solution
You are using IPython, and _i
has a special meaning pertaining specifically to IPython. In Python more generally, you can do such an assignment.
In IPython:
In [1]: _i = 1
In [2]: _i
Out[2]: '_i = 1'
In the standard Python REPL:
>>> _i = 1
>>> _i
1
More information here: https://ipython.org/ipython-doc/3/interactive/reference.html#input-caching-system
Answered By - user1781434
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.