# A Python-like REPL?

**URL:** <https://discourse.julialang.org/t/a-python-like-repl/76944>\
**Category:** General Usage\
**Tags:** repl\
**Created:** [February 23, 2022, 12:21am UTC](https://discourse.julialang.org/t/a-python-like-repl/76944 "2022-02-23T00:21:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seif\_Shebl](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Seif\_Shebl](https://discourse.julialang.org/u/Seif_Shebl)\
**Post date:** [February 23, 2022, 12:21am UTC](https://discourse.julialang.org/t/a-python-like-repl/76944/1 "2022-02-23T00:21:51Z")

</div>

The current Julia REPL behaves like MATLAB’s Command Window, that’s, it displays the output by default unless a line is terminated with a semi-colon `;` (except inner-lines). Python’s REPL, on the other hand, doesn’t show the output by default for any line containing the `=` sign. I find the latter to be much cleaner (no more `;` scattered everywhere and less cluttered with intermediate results of big objects) and consistent with other IDEs.

My question is can I customize my Julia REPL to behave like Python’s and get rid of these semi-colons? Also, what is your opinion about making that the default for Julia REPL?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [February 23, 2022, 12:43am UTC](https://discourse.julialang.org/t/a-python-like-repl/76944/2 "2022-02-23T00:43:59Z")

</div>

> [@Seif\_Shebl](#):
>
> Python’s REPL, on the other hand, doesn’t show the output by default for any line containing the `=` sign

That’s not a property of Python’s REPL, it’s a property of the Python _language_: assignment operations don’t produce a value. They later introduced the `:=` assignment expression which does produce values, but it was too late to change `=`. IPython [worked around this](https://ipython.readthedocs.io/en/stable/whatsnew/version6.html#assignments-return-values) and added an option to display assignment results.

In contrast, in Julia, an assignment has a value equal to its right hand side. That’s why it displays in the REPL — the same as any other expression that returns a value.

That being said, it’s pretty easy to suppress this if you want. Just add the following to your `~/.julia/config/startup.jl` file:

```julia
function _suppress_assignment_printing(ex)
    if Meta.isexpr(ex, :toplevel) && Meta.isexpr(ex.args[end], :(=), 2)
        return Expr(:toplevel, ex.args..., nothing)
    else
        return ex
    end
end

import REPL
if isdefined(Base, :active_repl_backend)
    pushfirst!(Base.active_repl_backend.ast_transforms, _suppress_assignment_printing)
else
    pushfirst!(REPL.repl_ast_transforms, _suppress_assignment_printing)
end

```

---

<div class="post-metadata">

**Author:** ![Seif\_Shebl](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Seif\_Shebl](https://discourse.julialang.org/u/Seif_Shebl)\
**Post date:** [February 23, 2022, 12:53am UTC](https://discourse.julialang.org/t/a-python-like-repl/76944/3 "2022-02-23T00:53:27Z")

</div>

Thank you very much, it worked great.
