Do not update the unders if they are user defined...
Do not update the unders if they are user defined
Closes jupyter/notebook#1628 (once there are tests).
Still shift the internal reference to self._,__,___ but do not assign it
in user ns.
I would expect this to be a change of behavior and have the (slight)
side effect that if any of the _, __, or __ are defined, then none of
these are updated.
We could update the logic to do the right think on leapfrog _, __ or __
if user-set, but is it worth it.
If _ is in builtins, then _ will not update the history and _ will be
the builtins, unless user set it explicitly in which case it takes
precedence.
Summary
if user have set _
_ == value set by the user
elif _ in builtins:
_ == value in builtins._
else:
_ == previous result.
Note that this logic may fall down if the use set _ to a specific value,
and have this save value returned while _ is also in builtin:
In [1]: import gettext ; gettext.install('foo')
In [2]: _ = 'Example'
In [3]: _
Out[3]: 'Example'
In [4]: _
Out[4]: 'Example'
In [5]: _
Out[5]: <bound method NullTranslations.gettext of <...>>