modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
22.8k stars 2.58k forks source link

[Feature Request] Implicit Printing and Last Outputs in JupyterEnv #123

Open alperenunlu opened 1 year ago

alperenunlu commented 1 year ago

Request

Need Implicit Printing and accessing the last outputs using "_" and "__" in Playground

Motivation

For testing the language features using implicit printing and accessing last outputs in notebook environment helps a lot.

Description and Requirements

let x: Int = 2
x

outputs: 2

x * x

outputs: 4

_, __

outputs: (4, 2)

czheo commented 1 year ago

Maybe also _1, _2 and etc. Here are some examples: https://stackoverflow.com/questions/200020/get-last-result-in-interactive-python-shell

sa- commented 1 year ago

Support for jupyter's tab completion and shift+tab for documentation would also be very appreciated!