From 7de0f78b3c9dac972cdd2b9a46f8cdce7b99ab36 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 2 Nov 2026 11:38:30 +1100 Subject: [PATCH] [names] Use `builtins` and `%run`, as Python 3 and the code cells do - The built-in definitions are provided by the `builtins` module; `__builtin__` is its Python 2 name. - IPython's `run` command -> `%run`, matching the cells that use it. The French edition already says both (QuantEcon/lecture-python-programming.fr#80). Co-Authored-By: Claude Opus 5.5 --- lectures/names.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/names.md b/lectures/names.md index 3ce66b14..0658a2e7 100644 --- a/lectures/names.md +++ b/lectures/names.md @@ -226,7 +226,7 @@ To check this, we can look at the current module name via the value of `__name__ print(__name__) ``` -When we run a script using IPython's `run` command, the contents of the file are executed as part of `__main__` too. +When we run a script using IPython's `%run` command, the contents of the file are executed as part of `__main__` too. To see this, let's create a file `mod.py` that prints its own `__name__` attribute @@ -333,7 +333,7 @@ We have been using various built-in functions, such as `max(), dir(), str(), lis How does access to these names work? -* These definitions are stored in a module called `__builtin__`. +* These definitions are provided by the `builtins` module. * They have their own namespace called `__builtins__`. ```{code-cell} python3