Magic Command
A special IPython instruction prefixed with % (line) or %% (cell) beyond plain Python.
- Line magic: %name args. Cell magic: %%name args.
- Built-ins: timing, profiling, shell access, autoreload.
- %lsmagic lists all available magics.
When to use: Quick utilities: timing code, running shell commands, writing files, hot-reloading.
Example: %timeit np.dot(a, b) calibrates and reports mean. %%writefile model.py saves the cell.