You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
expressions in blocks don't print their value in the REPL #2527
Not sure if this is really a problem, though CPython's and PyPy's REPL do this, it up to whatever sys.displayhook does. IPython, for example, tinkers with the displayhook to do its own things and doesn't write out the repr of whatever expression is inside a compound statement.
Personally, I've never really found this useful and wouldn't really miss it.
I think the difference here is basically that in single mode, CPython emits PRINT_EXPR for the result of statements instead of POP_TOP, while we just return the value of the last statement and print that.
Activity
DimitrisJim commentedon May 16, 2021
Not sure if this is really a problem, though CPython's and PyPy's REPL do this, it up to whatever
sys.displayhookdoes. IPython, for example, tinkers with thedisplayhookto do its own things and doesn't write out thereprof whatever expression is inside a compound statement.Personally, I've never really found this useful and wouldn't really miss it.
coolreader18 commentedon May 16, 2021
I think the difference here is basically that in
singlemode, CPython emitsPRINT_EXPRfor the result of statements instead ofPOP_TOP, while we just return the value of the last statement and print that.DimitrisJim commentedon May 17, 2021
You're right on that:
do you think this warrants a change?
youknowone commentedon Oct 6, 2026
The originally reported problem no longer reproduces on current main. Closing per the recheck in #8982.
— commented by Grok 4.6