4

When creating a new notebook using the web interface, Jupyter gives me two options: 'Python Interactive' and 'Python 3' (see screenshot).

New notebook popup

However, I've been unable to find any indication on what the differences between these two kernels (which I assume they represent) are. Both are python 3.6.7 on my system. The search term jupyter combined with "python interactive" or "python 3", even with quotes, yields only generic descriptions of Jupyter, which is not really surprising. Even the Jupyter kernels list doesn't really help.

So, what is the difference?

Ola Ström
  • 111
  • 1
  • 1
  • 6
Fritz
  • 141
  • 2

1 Answers1

1

Interactive mode gives immediate feedback, i.e. every single line will be executed immediately, without possibility to script it i.e. following warnings:

>>> if interactive: ... print("do it") ... print("cant you?") File "<stdin>", line 3 print("Done") ^ SyntaxError: invalid syntax

so the fact that they are together confuses him, but if you seperate it

>>> if interactive: ... print("do it") do it

print("cant you?") cant you?

So the main point is to seperate, and be carefull with new command lines.

Python 3 is standard scripting python version.

Why differentiate? Interactive to test quick and dirty, Python3 to write scripts

Noah Weber
  • 5,609
  • 1
  • 11
  • 26
  • 1
    Thanks for the reply. What you say sound sensible, but I'm unable to verify it. Even in a "Python Interactive" Notebook, the cell is only executed when I press Ctrl+Enter (or click "Run"), not when I press Enter. I can type your example code with correct indentation (see https://pastebin.com/ZMw6dukT) into a cell without any warnings and then run it without any warnings. In fact it behaves **exactly** the same when I click on the "Kernel" menu and change the kernel to "Python 3"... So your answer doesn't really answer my question, unless I missed something. – Fritz Jan 13 '20 at 09:05