Skip to content

Commit 10c84e6

Browse files
committed
Docs: split builtins to their own page from library
1 parent eb08902 commit 10c84e6

9 files changed

Lines changed: 70 additions & 42 deletions

File tree

Doc/conf.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,13 @@
359359
# Grouping the document tree into LaTeX files. List of tuples
360360
# (source start file, target name, title, author, document class [howto/manual]).
361361
latex_documents = [
362-
('c-api/index', 'c-api.tex', 'The Python/C API', _doc_authors, 'manual'),
362+
(
363+
'c-api/index',
364+
'c-api.tex',
365+
'The Python/C API',
366+
_doc_authors,
367+
'manual',
368+
),
363369
(
364370
'extending/index',
365371
'extending.tex',
@@ -374,6 +380,13 @@
374380
_doc_authors,
375381
'manual',
376382
),
383+
(
384+
'library/builtin-index',
385+
'builtin.tex',
386+
'Built-in Functions and Classes',
387+
_doc_authors,
388+
'manual',
389+
),
377390
(
378391
'library/index',
379392
'library.tex',

Doc/contents.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
tutorial/index.rst
99
using/index.rst
1010
reference/index.rst
11+
library/builtin-index.rst
1112
library/index.rst
1213
extending/index.rst
1314
c-api/index.rst

Doc/extending/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ underlying operating system supports this feature.
1616

1717
This document assumes basic knowledge about C and Python. For an informal
1818
introduction to Python, see :ref:`tutorial-index`. :ref:`reference-index`
19-
gives a more formal definition of the language. :ref:`library-index` documents
20-
the existing object types, functions and modules (both built-in and written in
21-
Python) that give the language its wide application range.
19+
gives a more formal definition of the language. :ref:`builtin-index` documents
20+
the built-in functions and object types, and :ref:`library-index` documents the
21+
modules (both built-in and written in Python) that give the language its wide
22+
application range.
2223

2324
For a detailed description of the whole Python/C API, see the separate
2425
:ref:`c-api-index`.

Doc/library/builtin-index.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.. _builtin-index:
2+
3+
##################################
4+
Built-in Functions and Classes
5+
##################################
6+
7+
Python comes with a number of built-in functions and classes.
8+
9+
The built-in classes include data types that would normally be considered part of the "core" of a
10+
language, such as numbers and lists. For these types, the Python language core
11+
defines the form of literals and places some constraints on their semantics, but
12+
does not fully define the semantics.
13+
14+
The built-ins also includes functions and exceptions --- objects that can
15+
be used by all Python code without the need of an :keyword:`import` statement.
16+
Some of these are defined by the core language, but many are not essential for
17+
the core semantics and are only described here.
18+
19+
.. We don't use :numbered: option for the TOC below as it enforces
20+
numbered sections for the entire stdlib docs. If desired,
21+
:numbered: can be enabled on a per-module basis.
22+
.. toctree::
23+
:maxdepth: 2
24+
25+
functions.rst
26+
constants.rst
27+
stdtypes.rst
28+
exceptions.rst
29+
threadsafety.rst
30+
time-complexity.rst

Doc/library/index.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ the `Python Package Index <https://pypi.org>`_.
3939
:maxdepth: 2
4040

4141
intro.rst
42-
functions.rst
43-
constants.rst
44-
stdtypes.rst
45-
exceptions.rst
46-
threadsafety.rst
47-
time-complexity.rst
4842

4943
text.rst
5044
binary.rst

Doc/library/intro.rst

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,29 @@
44
Introduction
55
************
66

7-
The "Python library" contains several different kinds of components.
8-
9-
It contains data types that would normally be considered part of the "core" of a
10-
language, such as numbers and lists. For these types, the Python language core
11-
defines the form of literals and places some constraints on their semantics, but
12-
does not fully define the semantics. (On the other hand, the language core does
13-
define syntactic properties like the spelling and priorities of operators.)
14-
15-
The library also contains built-in functions and exceptions --- objects that can
16-
be used by all Python code without the need of an :keyword:`import` statement.
17-
Some of these are defined by the core language, but many are not essential for
18-
the core semantics and are only described here.
19-
20-
The bulk of the library, however, consists of a collection of modules. There are
21-
many ways to dissect this collection. Some modules are written in C and built
22-
in to the Python interpreter; others are written in Python and imported in
7+
Note: the built-in functions and classes (which can be used without an
8+
:keyword:`import` statement) are described in :ref:`builtin-index`.
9+
10+
The Python standard library consists of a collection of modules. There are
11+
many ways to dissect this collection. Some modules are written in C and compiled
12+
into the Python interpreter; others are written in Python and imported in
2313
source form. Some modules provide interfaces that are highly specific to
2414
Python, like printing a stack trace; some provide interfaces that are specific
2515
to particular operating systems, such as access to specific hardware; others
2616
provide interfaces that are specific to a particular application domain, like
27-
the World Wide Web. Some modules are available in all versions and ports of
17+
the web development. Some modules are available in all versions and ports of
2818
Python; others are only available when the underlying system supports or
2919
requires them; yet others are available only when a particular configuration
3020
option was chosen at the time when Python was compiled and installed.
3121

32-
This manual is organized "from the inside out:" it first describes the built-in
33-
functions, data types and exceptions, and finally the modules, grouped in
34-
chapters of related modules.
35-
36-
This means that if you start reading this manual from the start, and skip to the
22+
If you start reading this manual from the start, and skip to the
3723
next chapter when you get bored, you will get a reasonable overview of the
3824
available modules and application areas that are supported by the Python
3925
library. Of course, you don't *have* to read it like a novel --- you can also
4026
browse the table of contents (in front of the manual), or look for a specific
4127
function, module or term in the index (in the back). And finally, if you enjoy
42-
learning about random subjects, you choose a random page number (see module
43-
:mod:`random`) and read a section or two. Regardless of the order in which you
28+
learning about random subjects, you choose a random page
29+
and read a section or two. Regardless of the order in which you
4430
read the sections of this manual, it helps to start with chapter
4531
:ref:`built-in-funcs`, as the remainder of the manual assumes familiarity with
4632
this material.

Doc/reference/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
The Python Language Reference
55
#################################
66

7-
This reference manual describes the syntax and "core semantics" of the
7+
This reference manual describes the syntax and core semantics of the
88
language. It is terse, but attempts to be exact and complete. The semantics of
9-
non-essential built-in object types and of the built-in functions and modules
10-
are described in :ref:`library-index`. For an informal introduction to the
9+
built-in object types and of the built-in functions and modules
10+
are described in :ref:`builtin-index` and :ref:`library-index`.
11+
For an informal introduction to the
1112
language, see :ref:`tutorial-index`. For C or C++ programmers, two additional
1213
manuals exist: :ref:`extending-index` describes the high-level picture of how to
1314
write a Python extension module, and the :ref:`c-api-index` describes the

Doc/tools/templates/indexcontent.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ <h1>{{ docstitle|e }}</h1>
5656
<span class="linkdescr"> {% trans whatsnew_index=pathto("whatsnew/index") %}Or <a href="{{ whatsnew_index }}">all "What's new" documents since Python 2.0</a>{% endtrans %}</span></li>
5757
<li class="biglink"><a class="biglink" href="{{ pathto("tutorial/index") }}">{% trans %}Tutorial{% endtrans %}</a><br>
5858
<span class="linkdescr">{% trans %}Start here: a tour of Python's syntax and features{% endtrans %}</span></li>
59+
<li class="biglink"><a class="biglink" href="{{ pathto("library/builtin-index") }}">{% trans %}Built-in reference{% endtrans %}</a><br>
60+
<span class="linkdescr">{% trans %}Built-in functions and classes{% endtrans %}</span></li>
5961
<li class="biglink"><a class="biglink" href="{{ pathto("library/index") }}">{% trans %}Library reference{% endtrans %}</a><br>
6062
<span class="linkdescr">{% trans %}Standard library and builtins{% endtrans %}</span></li>
6163
<li class="biglink"><a class="biglink" href="{{ pathto("reference/index") }}">{% trans %}Language reference{% endtrans %}</a><br>
6264
<span class="linkdescr">{% trans %}Syntax and language elements{% endtrans %}</span></li>
6365
<li class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">{% trans %}Python setup and usage{% endtrans %}</a><br>
6466
<span class="linkdescr">{% trans %}How to install, configure, and use Python{% endtrans %}</span></li>
65-
<li class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">{% trans %}Python HOWTOs{% endtrans %}</a><br>
66-
<span class="linkdescr">{% trans %}In-depth topic manuals{% endtrans %}</span></li>
6767
</ul>
6868
<ul>
69+
<li class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">{% trans %}Python HOWTOs{% endtrans %}</a><br>
70+
<span class="linkdescr">{% trans %}In-depth topic manuals{% endtrans %}</span></li>
6971
<li class="biglink"><a class="biglink" href="{{ pathto("installing/index") }}">{% trans %}Installing Python modules{% endtrans %}</a><br>
7072
<span class="linkdescr">{% trans %}Third-party modules and PyPI.org{% endtrans %}</span></li>
7173
<li class="biglink"><a class="biglink" href="{{ pathto("extending/index") }}">{% trans %}Extending and embedding{% endtrans %}</a><br>

Doc/tutorial/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ have a basic understanding of programming in general. It helps to have a Python
3030
interpreter handy for hands-on experience, but all examples are self-contained,
3131
so the tutorial can be read off-line as well.
3232

33-
For a description of standard objects and modules, see :ref:`library-index`.
34-
:ref:`reference-index` gives a more formal definition of the language. To write
35-
extensions in C or C++, read :ref:`extending-index` and
33+
For a description of standard objects and modules, see :ref:`builtin-index` and
34+
:ref:`library-index`. :ref:`reference-index` gives a more formal definition of
35+
the language. To write extensions in C or C++, read :ref:`extending-index` and
3636
:ref:`c-api-index`. There are also several books covering Python in depth.
3737

3838
This tutorial does not attempt to be comprehensive and cover every single

0 commit comments

Comments
 (0)