Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 584265b

Browse files
committed
Add more entries to the glossary.
Written by Jeff Wheeler for GHOP.
1 parent b15a8df commit 584265b

21 files changed

Lines changed: 166 additions & 64 deletions

Doc/ACKS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ [email protected]), and we'll be glad to correct the problem.
185185
* Glyn Webster
186186
* Bob Weiner
187187
* Eddy Welbourne
188+
* Jeff Wheeler
188189
* Mats Wichmann
189190
* Gerry Wiener
190191
* Timothy Wild

Doc/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ htmlhelp: build
5757
@echo "Build finished; now you can run HTML Help Workshop with the" \
5858
"build/htmlhelp/pydoc.hhp project file."
5959

60+
latex: BUILDER = latex
61+
latex: build
62+
@echo "Build finished; the LaTeX files are in build/latex."
63+
6064
clean:
6165
-rm -rf build/*
6266
-rm -rf tools/sphinx

Doc/README.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Available make targets are:
4848
To create the CHM file, you need to run the Microsoft HTML Help Workshop
4949
over the generated project (.hhp) file.
5050

51+
* "latex", which builds LaTeX source files that can be run with "pdflatex"
52+
to produce PDF documents.
53+
5154
A "make update" updates the Subversion checkouts in `tools/`.
5255

5356

Doc/glossary.rst

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ Glossary
1515
``...``
1616
The typical Python prompt of the interactive shell when entering code for
1717
an indented code block.
18+
19+
argument
20+
A value passed to a function or method, assigned to a name local to
21+
the body. A function or method may have both positional arguments and
22+
keyword arguments in its definition. Positional and keyword arguments
23+
may be variable-length: ``*`` accepts or passes (if in the function
24+
definition or call) several positional arguments in a list, while ``**``
25+
does the same for keyword arguments in a dictionary.
26+
27+
Any expression may be used within the argument list, and the evaluated
28+
value is passed to the local variable.
1829

1930
BDFL
2031
Benevolent Dictator For Life, a.k.a. `Guido van Rossum
@@ -57,6 +68,22 @@ Glossary
5768
advanced mathematical feature. If you're not aware of a need for them,
5869
it's almost certain you can safely ignore them.
5970

71+
decorator
72+
A function returning another function, usually applied as a function
73+
transformation using the ``@wrapper`` syntax. Common examples for
74+
decorators are :func:`classmethod` and :func:`staticmethod`.
75+
76+
The decorator syntax is merely syntactic sugar, the following two
77+
function definitions are semantically equivalent::
78+
79+
def f(...):
80+
...
81+
f = staticmethod(f)
82+
83+
@staticmethod
84+
def f(...):
85+
...
86+
6087
descriptor
6188
Any *new-style* object that defines the methods :meth:`__get__`,
6289
:meth:`__set__`, or :meth:`__delete__`. When a class attribute is a
@@ -94,10 +121,24 @@ Glossary
94121
statements. The technique contrasts with the :term:`LBYL` style that is
95122
common in many other languages such as C.
96123

124+
expression
125+
A piece of syntax which can be evaluated to some value. In other words,
126+
an expression is an accumulation of expression elements like literals, names,
127+
attribute access, operators or function calls that all return a value.
128+
In contrast to other languages, not all language constructs are expressions,
129+
but there are also :term:`statement`\s that cannot be used as expressions,
130+
such as :keyword:`print` or :keyword:`if`. Assignments are also not
131+
expressions.
132+
97133
extension module
98134
A module written in C, using Python's C API to interact with the core and
99135
with user code.
100-
136+
137+
function
138+
A series of statements which returns some value to a caller. It can also
139+
be passed zero or more arguments which may be used in the execution of
140+
the body. See also :term:`argument` and :term:`method`.
141+
101142
__future__
102143
A pseudo module which programmers can use to enable new language features
103144
which are not compatible with the current interpreter. For example, the
@@ -241,6 +282,17 @@ Glossary
241282

242283
More information can be found in :ref:`typeiter`.
243284

285+
keyword argument
286+
Arguments which are preceded with a ``variable_name=`` in the call.
287+
The variable name designates the local name in the function to which the
288+
value is assigned. ``**`` is used to accept or pass a dictionary of
289+
keyword arguments. See :term:`argument`.
290+
291+
lambda
292+
An anonymous inline function consisting of a single :term:`expression`
293+
which is evaluated when the function is called. The syntax to create
294+
a lambda function is ``lambda [arguments]: expression``
295+
244296
LBYL
245297
Look before you leap. This coding style explicitly tests for
246298
pre-conditions before making calls or lookups. This style contrasts with
@@ -271,6 +323,12 @@ Glossary
271323
singletons, and many other tasks.
272324

273325
More information can be found in :ref:`metaclasses`.
326+
327+
method
328+
A function that is defined inside a class body. If called as an attribute
329+
of an instance of that class, the method will get the instance object as
330+
its first :term:`argument` (which is usually called ``self``).
331+
See :term:`function` and :term:`nested scope`.
274332

275333
mutable
276334
Mutable objects can change their value but keep their :func:`id`. See
@@ -305,10 +363,32 @@ Glossary
305363

306364
More information can be found in :ref:`newstyle`.
307365

366+
positional argument
367+
The arguments assigned to local names inside a function or method,
368+
determined by the order in which they were given in the call. ``*`` is
369+
used to either accept multiple positional arguments (when in the
370+
definition), or pass several arguments as a list to a function. See
371+
:term:`argument`.
372+
308373
Python 3000
309374
Nickname for the next major Python version, 3.0 (coined long ago when the
310375
release of version 3 was something in the distant future.)
311376

377+
Pythonic
378+
An idea or piece of code which closely follows the most common idioms of
379+
the Python language, rather than implementing code using concepts common
380+
in other languages. For example, a common idiom in Python is the :keyword:`for`
381+
loop structure; other languages don't have this easy keyword, so people
382+
use a numerical counter instead::
383+
384+
for i in range(len(food)):
385+
print food[i]
386+
387+
As opposed to the cleaner, Pythonic method::
388+
389+
for piece in food:
390+
print piece
391+
312392
reference count
313393
The number of places where a certain object is referenced to. When the
314394
reference count drops to zero, an object is deallocated. While reference
@@ -331,6 +411,18 @@ Glossary
331411
mapping rather than a sequence because the lookups use arbitrary
332412
:term:`immutable` keys rather than integers.
333413

414+
slice
415+
A list containing a portion of an indexed list-like object. A slice is
416+
created using the subscript notation, ``[]`` with colons between numbers
417+
when several are given, such as in ``variable_name[1:3:5]``. The bracket
418+
(subscript) notation uses :class:`slice` objects internally (or in older
419+
versions, :meth:`__getslice__` and :meth:`__setslice__`).
420+
421+
statement
422+
A statement is part of a suite (a "block" of code). A statement is either
423+
an :term:`expression` or a one of several constructs with a keyword, such
424+
as :keyword:`if`, :keyword:`while` or :keyword:`print`.
425+
334426
type
335427
The type of a Python object determines what kind of object it is; every
336428
object has a type. An object's type is accessible as its

Doc/library/atexit.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ passed along to the registered function when it is called::
9696
# or:
9797
atexit.register(goodbye, adjective='nice', name='Donny')
9898

99-
Usage as a decorator::
99+
Usage as a :term:`decorator`::
100100

101101
import atexit
102102

Doc/library/bdb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ structure representing a stack trace.
290290

291291

292292
The following two methods can be called by clients to use a debugger to debug a
293-
statement, given as a string.
293+
:term:`statement`, given as a string.
294294

295295
.. method:: Bdb.run(cmd, [globals, [locals]])
296296

Doc/library/codecs.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,9 +1119,9 @@ the table.
11191119
| | | | all conversions. Can be |
11201120
| | | | used as the system |
11211121
| | | | encoding if no automatic |
1122-
| | | | coercion between byte and |
1123-
| | | | Unicode strings is |
1124-
| | | | desired. |
1122+
| | | | :term:`coercion` between |
1123+
| | | | byte and Unicode strings |
1124+
| | | | is desired. |
11251125
+--------------------+---------------------------+----------------+---------------------------+
11261126
| unicode_escape | | Unicode string | Produce a string that is |
11271127
| | | | suitable as Unicode |

Doc/library/codeop.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ To do just the former:
4343
:exc:`OverflowError` or :exc:`ValueError` if there is an invalid literal.
4444

4545
The *symbol* argument determines whether *source* is compiled as a statement
46-
(``'single'``, the default) or as an expression (``'eval'``). Any other value
47-
will cause :exc:`ValueError` to be raised.
46+
(``'single'``, the default) or as an :term:`expression` (``'eval'``). Any
47+
other value will cause :exc:`ValueError` to be raised.
4848

4949
.. warning::
5050

Doc/library/contextlib.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ Functions provided:
1717

1818
.. function:: contextmanager(func)
1919

20-
This function is a decorator that can be used to define a factory function for
21-
:keyword:`with` statement context managers, without needing to create a class or
22-
separate :meth:`__enter__` and :meth:`__exit__` methods.
20+
This function is a :term:`decorator` that can be used to define a factory
21+
function for :keyword:`with` statement context managers, without needing to
22+
create a class or separate :meth:`__enter__` and :meth:`__exit__` methods.
2323

2424
A simple example (this is not recommended as a real way of generating HTML!)::
2525

Doc/library/doctest.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,8 @@ capabilities, then you should use the advanced API.
11351135
The advanced API revolves around two container classes, which are used to store
11361136
the interactive examples extracted from doctest cases:
11371137

1138-
* :class:`Example`: A single python statement, paired with its expected output.
1138+
* :class:`Example`: A single python :term:`statement`, paired with its expected
1139+
output.
11391140

11401141
* :class:`DocTest`: A collection of :class:`Example`\ s, typically extracted
11411142
from a single docstring or text file.

0 commit comments

Comments
 (0)