Commit 43b5e407 authored by Raymond Hettinger's avatar Raymond Hettinger

* Fix markup.

* Fix entry order:
  -  >>> before ...
  - __slots__ in the S section (like __future__ is in the F section)

Need to test the repaired(?) link to Guido's webpage.

Still needs to have the module reference links made relative to
the module directory instead of the tut directory.  That will
require Fred's magic touch.
parent 36bd2a1d
...@@ -5,28 +5,21 @@ ...@@ -5,28 +5,21 @@
\begin{description} \begin{description}
\index{...}
\item[\code{.\code{.}.}]
The typical Python prompt of the interactive shell when entering code
for an indented code block.
\index{>>>} \index{>>>}
\item[\code{>\code{>}>}] \item[\code{>\code{>}>}]
The typical Python prompt of the interactive shell. Often seen for The typical Python prompt of the interactive shell. Often seen for
code examples that can be tried right away in the interpreter. code examples that can be tried right away in the interpreter.
\index{__slots__} \index{...}
\item[__slots__] \item[\code{.\code{.}.}]
A declaration inside a \emph{new-style class} that saves memory by The typical Python prompt of the interactive shell when entering code
pre-declaring space for instance attributes and eliminating instance for an indented code block.
dictionaries. Though popular, the technique is somewhat tricky to get
right and is best reserved for rare cases where there are large
numbers of instances in a memory critical application.
\index{BDFL} \index{BDFL}
\item[BDFL] \item[BDFL]
Benevolent Dictator For Life, a.k.a. \ulink{Guido van Benevolent Dictator For Life, a.k.a. \ulink{Guido van
Rossum}{http://www.python.org/~guido/}, Python's creator. Rossum}{http://www.python.org/\textasciitilde{}guido/}, Python's creator.
\index{byte code} \index{byte code}
\item[byte code] \item[byte code]
...@@ -34,8 +27,8 @@ The internal representation of a Python program in the interpreter. ...@@ -34,8 +27,8 @@ The internal representation of a Python program in the interpreter.
The byte code is also cached in the \code{.pyc} and \code{.pyo} The byte code is also cached in the \code{.pyc} and \code{.pyo}
files so that executing the same file is faster the second time files so that executing the same file is faster the second time
(compilation from source to byte code can be saved). This (compilation from source to byte code can be saved). This
\emph{intermediate language} is said to run on a \emph{virtual ``intermediate language'' is said to run on a ``virtual
machine} that calls the subroutines corresponding to each bytecode. machine'' that calls the subroutines corresponding to each bytecode.
\index{classic class} \index{classic class}
\item[classic class] \item[classic class]
...@@ -47,8 +40,8 @@ Any class which does not inherit from \class{object}. See ...@@ -47,8 +40,8 @@ Any class which does not inherit from \class{object}. See
Converting data from one type to another. For example, Converting data from one type to another. For example,
{}\code{int(3.15)} coerces the floating point number to the integer, {}\code{int(3.15)} coerces the floating point number to the integer,
{}\code{3}. Most mathematical operations have rules for coercing {}\code{3}. Most mathematical operations have rules for coercing
their arguments to a common type. For instance, adding \code{3 + their arguments to a common type. For instance, adding \code{3+4.5},
4.5}, causes the integer \code{3} to be coerced to be a float causes the integer \code{3} to be coerced to be a float
{}\code{3.0} before adding to \code{4.5} resulting in the float {}\code{3.0} before adding to \code{4.5} resulting in the float
{}\code{7.5}. {}\code{7.5}.
...@@ -85,15 +78,15 @@ fast style is characterized by the presence of many \keyword{try} and ...@@ -85,15 +78,15 @@ fast style is characterized by the presence of many \keyword{try} and
\item[__future__] \item[__future__]
A pseudo module which programmers can use to enable new language A pseudo module which programmers can use to enable new language
features which are not compatible with the current interpreter. For features which are not compatible with the current interpreter. For
example, the expression \code{11 / 4} currently evaluates to \code{2}. example, the expression \code{11/4} currently evaluates to \code{2}.
If the module in which it is executed had enabled emph{true division} If the module in which it is executed had enabled \emph{true division}
by executing: by executing:
\begin{verbatim} \begin{verbatim}
from __future__ import division from __future__ import division
\end{verbatim} \end{verbatim}
the expression \code{11 / 4} would evaluate to \code{2.75}. By the expression \code{11/4} would evaluate to \code{2.75}. By
actually importing the \refmodule[future]{__future__} module and actually importing the \refmodule[future]{__future__} module and
evaluating its variables, you can see when a new feature was first evaluating its variables, you can see when a new feature was first
added to the language and when it will become the default: added to the language and when it will become the default:
...@@ -127,7 +120,7 @@ processes can access the same memory at the same time. Locking the ...@@ -127,7 +120,7 @@ processes can access the same memory at the same time. Locking the
entire interpreter makes it easier for the interpreter to be entire interpreter makes it easier for the interpreter to be
multi-threaded, at the expense of some parallelism on multi-processor multi-threaded, at the expense of some parallelism on multi-processor
machines. Efforts have been made in the past to create a machines. Efforts have been made in the past to create a
"free-threaded" interpreter (one which locks shared data at a much ``free-threaded'' interpreter (one which locks shared data at a much
finer granularity), but performance suffered in the common finer granularity), but performance suffered in the common
single-processor case. single-processor case.
...@@ -150,7 +143,7 @@ example as a key in a dictionary. ...@@ -150,7 +143,7 @@ example as a key in a dictionary.
\index{integer division} \index{integer division}
\item[integer division] \item[integer division]
Mathematical division discarding any remainder. For example, the Mathematical division discarding any remainder. For example, the
expression \code{11 / 4} currently evaluates to \code{2} in contrast expression \code{11/4} currently evaluates to \code{2} in contrast
to the \code{2.75} returned by float division. Also called to the \code{2.75} returned by float division. Also called
{}\emph{floor division}. When dividing two integers the outcome will {}\emph{floor division}. When dividing two integers the outcome will
always be another integer (having the floor function applied to it). always be another integer (having the floor function applied to it).
...@@ -180,7 +173,7 @@ a shorter development/debug cycle than compiled ones. See also ...@@ -180,7 +173,7 @@ a shorter development/debug cycle than compiled ones. See also
\index{iterable} \index{iterable}
\item[iterable] \item[iterable]
A container object capable of returning its members one at a time. A container object capable of returning its members one at a time.
Examples of iterables include all sequence types (such as\class{list}, Examples of iterables include all sequence types (such as \class{list},
{}\class{str}, and \class{tuple}) and some non-sequence types like {}\class{str}, and \class{tuple}) and some non-sequence types like
{}\class{dict} and \class{file} and objects of any classes you define {}\class{dict} and \class{file} and objects of any classes you define
with an \method{__iter__()} or \method{__getitem__()} method. Iterables with an \method{__iter__()} or \method{__getitem__()} method. Iterables
...@@ -190,7 +183,7 @@ iterable object is passed as an argument to the builtin function ...@@ -190,7 +183,7 @@ iterable object is passed as an argument to the builtin function
{}\function{iter()}, it returns an iterator for the object. This {}\function{iter()}, it returns an iterator for the object. This
iterator is good for one pass over the set of values. When using iterator is good for one pass over the set of values. When using
iterables, it is usually not necessary to call \function{iter()} or iterables, it is usually not necessary to call \function{iter()} or
deal with iterator objects yourself---the \code{for} statement does deal with iterator objects yourself. The \code{for} statement does
that automatically for you, creating a temporary unnamed variable to that automatically for you, creating a temporary unnamed variable to
hold the iterator for the duration of the loop. See also hold the iterator for the duration of the loop. See also
{}\emph{iterator}, \emph{sequence}, and \emph{generator}. {}\emph{iterator}, \emph{sequence}, and \emph{generator}.
...@@ -281,7 +274,7 @@ global namespace. ...@@ -281,7 +274,7 @@ global namespace.
Any class that inherits from \class{object}. This includes all Any class that inherits from \class{object}. This includes all
built-in types like \class{list} and \class{dict}. Only new-style built-in types like \class{list} and \class{dict}. Only new-style
classes can use Python's newer, versatile features like classes can use Python's newer, versatile features like
{}\var{__slots__}, descriptors, properties, {}\method{__slots__}, descriptors, properties,
\method{__getattribute__()}, class methods, and static methods. \method{__getattribute__()}, class methods, and static methods.
\index{Python3000} \index{Python3000}
...@@ -289,6 +282,14 @@ classes can use Python's newer, versatile features like ...@@ -289,6 +282,14 @@ classes can use Python's newer, versatile features like
A mythical python release, allowed not to be backward compatible, with A mythical python release, allowed not to be backward compatible, with
telepathic interface. telepathic interface.
\index{__slots__}
\item[__slots__]
A declaration inside a \emph{new-style class} that saves memory by
pre-declaring space for instance attributes and eliminating instance
dictionaries. Though popular, the technique is somewhat tricky to get
right and is best reserved for rare cases where there are large
numbers of instances in a memory critical application.
\index{sequence} \index{sequence}
\item[sequence] \item[sequence]
An \emph{iterable} which supports efficient element access using An \emph{iterable} which supports efficient element access using
...@@ -304,6 +305,6 @@ rather than integers. ...@@ -304,6 +305,6 @@ rather than integers.
\item[Zen of Python] \item[Zen of Python]
Listing of Python design principles and philosophies that are helpful Listing of Python design principles and philosophies that are helpful
in understanding and using the language. The listing can be found by in understanding and using the language. The listing can be found by
typing \code{import this} at the interactive prompt. typing ``\code{import this}'' at the interactive prompt.
\end{description} \end{description}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment