Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on configuring notebook to not print after every cell #195

Open
dillontiner opened this issue Mar 21, 2019 · 3 comments
Open

Question on configuring notebook to not print after every cell #195

dillontiner opened this issue Mar 21, 2019 · 3 comments

Comments

@dillontiner
Copy link

dillontiner commented Mar 21, 2019

Is there a way to configure the notebook to not print output without having to return nil in every cell? If not, perhaps this could be implemented as a magic command: https://ipython.readthedocs.io/en/stable/interactive/magics.html

I'm working with a lot of text data and my kernel will slow or even die when I forget to add nil to the end of the cell.

@dillontiner dillontiner changed the title Question on configuring notebook not to print Question on configuring notebook to not print after every cell Mar 21, 2019
@mrkn
Copy link
Contributor

mrkn commented May 9, 2019

I have a plan to implement the display prevention which is enabled by putting ; at the end of a cell. This behavior is same as IJulia.

Please wait a moment. Or, please give me a pull-request.

@ankane
Copy link
Contributor

ankane commented May 16, 2020

Wanted to voice my support for this as well. Python currently won't output on assignment.

a = 1 + 2 # no output
1 + 2     # output

IRB in Ruby 2.7 was changed to have the same behavior.

a = 1 + 2 # no output
1 + 2     # output

Would be great to see this as the default, as this was the biggest thing I noticed when switching from Python notebooks.

@ankane
Copy link
Contributor

ankane commented Jan 3, 2021

I have a branch to support this once #276 is merged. The basic code is:

module IRuby
  class PlainBackend
    def eval(code, store_history)
      @irb.context.evaluate(code, 0)
      @irb.context.last_value unless assignment_expression?(code)
    end

    def assignment_expression?(code)
      @irb.respond_to?(:assignment_expression?, true) && @irb.send(:assignment_expression?, code)
    end
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants