A common pattern in my notebooks is cells ending with
my_var = STUFF
my_var
or equivalently
display(my_var := STUFF)
I would prefer if I could instead end the cell with
my_var := STUFF
or something similarly short.
Is there a way to resolve this annoyance?
This is an upstream wontfix
from CPython, as discussed on IPython.
The workaround is to wrap the assignment in a parenthesis, e.g.
(x := 1)
1 Like
Thanks for sharing.
I found a solution on the discussion you linked: I now run
config InteractiveShell.ast_node_interactivity=‘last_expr_or_assign’
automatically every session.
Let’s hope this won’t have unpleasant side effects 
unpleasant side effects
really just the ones cited on the upstream CPython, where the syntax is less portable.