In Jupyter, kernels provide support for different languages we want to use in the notebook (such as IRkernel). How is this different from using the magics to write in other languages (%load_ext rmagic and using %%R throughout the code)?
Asked
Active
Viewed 205 times
1 Answers
2
the difference is that kernel are native, ie, Kernels are processes that speak a protocol that allow remote execution and code completions. So you can hence an R kernel, purely in R, and a julia Kernel, purely in Julia.
in the other hand, magics (%%R, %%fortran
) are at the beginning Python-only, they ask the Python kernel to execute a piece of code into another language, through bindings libraries. Most of the times, the magics are just a syntactic sugar for Python libraries call.
From a user perspective, the difference is small, but can have some consequences. It is harder to exchange variables in between kernel for example. With magics, data exchange is easier, but completion and introspection is harder.
Hope that helps.

Matt
- 27,170
- 6
- 80
- 74