summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-12-02 09:40:06 (GMT)
committerGeorg Brandl <georg@python.org>2007-12-02 09:40:06 (GMT)
commit1a3284ed69d545e4ef59869998cb8c29233a45fa (patch)
tree98728a9b7aae6188ee8124160007a9d5c5277f8c /Doc
parent87f9c53937ce47f55851ac7c71a94e46cf9142bf (diff)
downloadcpython-1a3284ed69d545e4ef59869998cb8c29233a45fa.zip
cpython-1a3284ed69d545e4ef59869998cb8c29233a45fa.tar.gz
cpython-1a3284ed69d545e4ef59869998cb8c29233a45fa.tar.bz2
#1535: rename __builtin__ module to builtins.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/init.rst8
-rw-r--r--Doc/c-api/intro.rst4
-rw-r--r--Doc/glossary.rst2
-rw-r--r--Doc/library/builtins.rst (renamed from Doc/library/__builtin__.rst)12
-rw-r--r--Doc/library/functions.rst4
-rw-r--r--Doc/library/imputil.rst10
-rw-r--r--Doc/library/python.rst2
-rw-r--r--Doc/library/rlcompleter.rst2
-rw-r--r--Doc/library/runpy.rst2
-rw-r--r--Doc/library/sys.rst2
-rw-r--r--Doc/reference/executionmodel.rst8
-rw-r--r--Doc/reference/lexical_analysis.rst2
-rw-r--r--Doc/reference/toplevel_components.rst4
-rw-r--r--Doc/tutorial/classes.rst2
-rw-r--r--Doc/tutorial/modules.rst8
15 files changed, 36 insertions, 36 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 0058e10..3467ed7 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -17,7 +17,7 @@ Initialization, Finalization, and Threads
single: PyEval_AcquireLock()
single: modules (in module sys)
single: path (in module sys)
- module: __builtin__
+ module: builtins
module: __main__
module: sys
triple: module; search; path
@@ -29,7 +29,7 @@ Initialization, Finalization, and Threads
exception of :cfunc:`Py_SetProgramName`, :cfunc:`PyEval_InitThreads`,
:cfunc:`PyEval_ReleaseLock`, and :cfunc:`PyEval_AcquireLock`. This initializes
the table of loaded modules (``sys.modules``), and creates the fundamental
- modules :mod:`__builtin__`, :mod:`__main__` and :mod:`sys`. It also initializes
+ modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It also initializes
the module search path (``sys.path``). It does not set ``sys.argv``; use
:cfunc:`PySys_SetArgv` for that. This is a no-op when called for a second time
(without calling :cfunc:`Py_Finalize` first). There is no return value; it is a
@@ -83,7 +83,7 @@ Initialization, Finalization, and Threads
.. cfunction:: PyThreadState* Py_NewInterpreter()
.. index::
- module: __builtin__
+ module: builtins
module: __main__
module: sys
single: stdout (in module sys)
@@ -93,7 +93,7 @@ Initialization, Finalization, and Threads
Create a new sub-interpreter. This is an (almost) totally separate environment
for the execution of Python code. In particular, the new interpreter has
separate, independent versions of all imported modules, including the
- fundamental modules :mod:`__builtin__`, :mod:`__main__` and :mod:`sys`. The
+ fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. The
table of loaded modules (``sys.modules``) and the module search path
(``sys.path``) are also separate. The new environment has no ``sys.argv``
variable. It has new standard I/O stream file objects ``sys.stdin``,
diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst
index 60b0052..0717241 100644
--- a/Doc/c-api/intro.rst
+++ b/Doc/c-api/intro.rst
@@ -507,7 +507,7 @@ interpreter can only be used after the interpreter has been initialized.
.. index::
single: Py_Initialize()
- module: __builtin__
+ module: builtins
module: __main__
module: sys
module: exceptions
@@ -516,7 +516,7 @@ interpreter can only be used after the interpreter has been initialized.
The basic initialization function is :cfunc:`Py_Initialize`. This initializes
the table of loaded modules, and creates the fundamental modules
-:mod:`__builtin__`, :mod:`__main__`, :mod:`sys`, and :mod:`exceptions`. It also
+:mod:`builtins`, :mod:`__main__`, :mod:`sys`, and :mod:`exceptions`. It also
initializes the module search path (``sys.path``).
.. index:: single: PySys_SetArgv()
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
index aa69867..cb75f84 100644
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -268,7 +268,7 @@ Glossary
dictionaries. There are the local, global and builtin namespaces as well
as nested namespaces in objects (in methods). Namespaces support
modularity by preventing naming conflicts. For instance, the functions
- :func:`__builtin__.open` and :func:`os.open` are distinguished by their
+ :func:`builtins.open` and :func:`os.open` are distinguished by their
namespaces. Namespaces also aid readability and maintainability by making
it clear which module implements a function. For instance, writing
:func:`random.seed` or :func:`itertools.izip` makes it clear that those
diff --git a/Doc/library/__builtin__.rst b/Doc/library/builtins.rst
index b3e1e11..2a5c7f5 100644
--- a/Doc/library/__builtin__.rst
+++ b/Doc/library/builtins.rst
@@ -1,13 +1,13 @@
-:mod:`__builtin__` --- Built-in objects
-=======================================
+:mod:`builtins` --- Built-in objects
+====================================
-.. module:: __builtin__
+.. module:: builtins
:synopsis: The module that provides the built-in namespace.
This module provides direct access to all 'built-in' identifiers of Python; for
-example, ``__builtin__.open`` is the full name for the built-in function
+example, ``builtins.open`` is the full name for the built-in function
:func:`open`. See chapter :ref:`builtin`.
This module is not normally accessed explicitly by most applications, but can be
@@ -16,10 +16,10 @@ but in which the built-in of that name is also needed. For example, in a module
that wants to implement an :func:`open` function that wraps the built-in
:func:`open`, this module can be used directly::
- import __builtin__
+ import builtins
def open(path):
- f = __builtin__.open(path, 'r')
+ f = builtins.open(path, 'r')
return UpperCaser(f)
class UpperCaser:
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 68601e5..5d0d8a5 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -356,7 +356,7 @@ available. They are listed here in alphabetical order.
dictionaries as global and local namespace. If the *globals* dictionary is
present and lacks '__builtins__', the current globals are copied into *globals*
before *expression* is parsed. This means that *expression* normally has full
- access to the standard :mod:`__builtin__` module and restricted environments are
+ access to the standard :mod:`builtins` module and restricted environments are
propagated. If the *locals* dictionary is omitted it defaults to the *globals*
dictionary. If both dictionaries are omitted, the expression is executed in the
environment where :keyword:`eval` is called. The return value is the result of
@@ -398,7 +398,7 @@ available. They are listed here in alphabetical order.
If the *globals* dictionary does not contain a value for the key
``__builtins__``, a reference to the dictionary of the built-in module
- :mod:`__builtin__` is inserted under that key. That way you can control what
+ :mod:`builtins` is inserted under that key. That way you can control what
builtins are available to the executed code by inserting your own
``__builtins__`` dictionary into *globals* before passing it to :func:`exec`.
diff --git a/Doc/library/imputil.rst b/Doc/library/imputil.rst
index eff1cb9..c05ae1a 100644
--- a/Doc/library/imputil.rst
+++ b/Doc/library/imputil.rst
@@ -108,7 +108,7 @@ This code is intended to be read, not executed. However, it does work
::
- import sys, imp, __builtin__
+ import sys, imp, builtins
# Replacement for __import__()
def import_hook(name, globals=None, locals=None, fromlist=None):
@@ -218,12 +218,12 @@ This code is intended to be read, not executed. However, it does work
# Save the original hooks
- original_import = __builtin__.__import__
- original_reload = __builtin__.reload
+ original_import = builtins.__import__
+ original_reload = builtins.reload
# Now install our hooks
- __builtin__.__import__ = import_hook
- __builtin__.reload = reload_hook
+ builtins.__import__ = import_hook
+ builtins.reload = reload_hook
.. index::
module: knee
diff --git a/Doc/library/python.rst b/Doc/library/python.rst
index 3384322..0fdfa53 100644
--- a/Doc/library/python.rst
+++ b/Doc/library/python.rst
@@ -13,7 +13,7 @@ overview:
.. toctree::
sys.rst
- __builtin__.rst
+ builtins.rst
__main__.rst
warnings.rst
contextlib.rst
diff --git a/Doc/library/rlcompleter.rst b/Doc/library/rlcompleter.rst
index 402a120..cec1e86 100644
--- a/Doc/library/rlcompleter.rst
+++ b/Doc/library/rlcompleter.rst
@@ -55,7 +55,7 @@ Completer objects have the following method:
Return the *state*th completion for *text*.
If called for *text* that doesn't include a period character (``'.'``), it will
- complete from names currently defined in :mod:`__main__`, :mod:`__builtin__` and
+ complete from names currently defined in :mod:`__main__`, :mod:`builtins` and
keywords (as defined by the :mod:`keyword` module).
If called for a dotted name, it will try to evaluate anything without obvious
diff --git a/Doc/library/runpy.rst b/Doc/library/runpy.rst
index d476879..2254906 100644
--- a/Doc/library/runpy.rst
+++ b/Doc/library/runpy.rst
@@ -46,7 +46,7 @@ The :mod:`runpy` module provides a single function:
does not make filename information available, this variable is set to ``None``.
``__builtins__`` is automatically initialised with a reference to the top level
- namespace of the :mod:`__builtin__` module.
+ namespace of the :mod:`builtins` module.
If the argument *alter_sys* is supplied and evaluates to ``True``, then
``sys.argv[0]`` is updated with the value of ``__file__`` and
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 33de4f6..3b9112a 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -78,7 +78,7 @@ always available.
.. function:: displayhook(value)
If *value* is not ``None``, this function prints it to ``sys.stdout``, and saves
- it in ``__builtin__._``.
+ it in ``builtins._``.
``sys.displayhook`` is called on the result of evaluating an expression entered
in an interactive Python session. The display of these values can be customized
diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst
index 1478cc7..1f85e49 100644
--- a/Doc/reference/executionmodel.rst
+++ b/Doc/reference/executionmodel.rst
@@ -105,7 +105,7 @@ If the :keyword:`global` statement occurs within a block, all uses of the name
specified in the statement refer to the binding of that name in the top-level
namespace. Names are resolved in the top-level namespace by searching the
global namespace, i.e. the namespace of the module containing the code block,
-and the builtin namespace, the namespace of the module :mod:`__builtin__`. The
+and the builtin namespace, the namespace of the module :mod:`builtins`. The
global namespace is searched first. If the name is not found there, the builtin
namespace is searched. The global statement must precede all uses of the name.
@@ -117,8 +117,8 @@ The built-in namespace associated with the execution of a code block is actually
found by looking up the name ``__builtins__`` in its global namespace; this
should be a dictionary or a module (in the latter case the module's dictionary
is used). By default, when in the :mod:`__main__` module, ``__builtins__`` is
-the built-in module :mod:`__builtin__` (note: no 's'); when in any other module,
-``__builtins__`` is an alias for the dictionary of the :mod:`__builtin__` module
+the built-in module :mod:`builtins`; when in any other module,
+``__builtins__`` is an alias for the dictionary of the :mod:`builtins` module
itself. ``__builtins__`` can be set to a user-created dictionary to create a
weak form of restricted execution.
@@ -126,7 +126,7 @@ weak form of restricted execution.
Users should not touch ``__builtins__``; it is strictly an implementation
detail. Users wanting to override values in the built-in namespace should
- :keyword:`import` the :mod:`__builtin__` (no 's') module and modify its
+ :keyword:`import` the :mod:`builtins` module and modify its
attributes appropriately.
.. index:: module: __main__
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst
index 1b315a6..741f8ec 100644
--- a/Doc/reference/lexical_analysis.rst
+++ b/Doc/reference/lexical_analysis.rst
@@ -344,7 +344,7 @@ characters:
``_*``
Not imported by ``from module import *``. The special identifier ``_`` is used
in the interactive interpreter to store the result of the last evaluation; it is
- stored in the :mod:`__builtin__` module. When not in interactive mode, ``_``
+ stored in the :mod:`builtins` module. When not in interactive mode, ``_``
has no special meaning and is not defined. See section :ref:`import`.
.. note::
diff --git a/Doc/reference/toplevel_components.rst b/Doc/reference/toplevel_components.rst
index 0ab9aaf..21f801c 100644
--- a/Doc/reference/toplevel_components.rst
+++ b/Doc/reference/toplevel_components.rst
@@ -23,13 +23,13 @@ Complete Python programs
.. index::
module: sys
module: __main__
- module: __builtin__
+ module: builtins
While a language specification need not prescribe how the language interpreter
is invoked, it is useful to have a notion of a complete Python program. A
complete Python program is executed in a minimally initialized environment: all
built-in and standard modules are available, but none have been initialized,
-except for :mod:`sys` (various system services), :mod:`__builtin__` (built-in
+except for :mod:`sys` (various system services), :mod:`builtins` (built-in
functions, exceptions and ``None``) and :mod:`__main__`. The latter is used to
provide the local and global namespace for execution of the complete program.
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst
index 4e95419..577c7e9 100644
--- a/Doc/tutorial/classes.rst
+++ b/Doc/tutorial/classes.rst
@@ -98,7 +98,7 @@ until the interpreter quits. The statements executed by the top-level
invocation of the interpreter, either read from a script file or interactively,
are considered part of a module called :mod:`__main__`, so they have their own
global namespace. (The built-in names actually also live in a module; this is
-called :mod:`__builtin__`.)
+called :mod:`builtins`.)
The local namespace for a function is created when the function is called, and
deleted when the function returns or raises an exception that is not handled
diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst
index 4d8b48f..2a14b35 100644
--- a/Doc/tutorial/modules.rst
+++ b/Doc/tutorial/modules.rst
@@ -308,14 +308,14 @@ Without arguments, :func:`dir` lists the names you have defined currently::
Note that it lists all types of names: variables, modules, functions, etc.
-.. index:: module: __builtin__
+.. index:: module: builtins
:func:`dir` does not list the names of built-in functions and variables. If you
want a list of those, they are defined in the standard module
-:mod:`__builtin__`::
+:mod:`builtins`::
- >>> import __builtin__
- >>> dir(__builtin__)
+ >>> import builtins
+ >>> dir(builtins)
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'Buffer
Error', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Excep