[Python-checkins] r58192 - python/trunk/Doc/reference/index.rst python/trunk/Doc/reference/simple_stmts.rst

georg.brandl python-checkins at python.org
Tue Sep 18 09:24:41 CEST 2007


Author: georg.brandl
Date: Tue Sep 18 09:24:40 2007
New Revision: 58192

Modified:
   python/trunk/Doc/reference/index.rst
   python/trunk/Doc/reference/simple_stmts.rst
Log:
A bit of reordering, also show more subheadings in the lang ref index.


Modified: python/trunk/Doc/reference/index.rst
==============================================================================
--- python/trunk/Doc/reference/index.rst	(original)
+++ python/trunk/Doc/reference/index.rst	Tue Sep 18 09:24:40 2007
@@ -17,7 +17,7 @@
 interfaces available to C/C++ programmers in detail.
 
 .. toctree::
-   :maxdepth: 2
+   :maxdepth: 3
 
    introduction.rst
    lexical_analysis.rst

Modified: python/trunk/Doc/reference/simple_stmts.rst
==============================================================================
--- python/trunk/Doc/reference/simple_stmts.rst	(original)
+++ python/trunk/Doc/reference/simple_stmts.rst	Tue Sep 18 09:24:40 2007
@@ -66,48 +66,6 @@
 cause any output.)
 
 
-.. _assert:
-
-Assert statements
-=================
-
-.. index::
-   statement: assert
-   pair: debugging; assertions
-
-Assert statements are a convenient way to insert debugging assertions into a
-program:
-
-.. productionlist::
-   assert_stmt: "assert" `expression` ["," `expression`]
-
-The simple form, ``assert expression``, is equivalent to ::
-
-   if __debug__:
-      if not expression: raise AssertionError
-
-The extended form, ``assert expression1, expression2``, is equivalent to ::
-
-   if __debug__:
-      if not expression1: raise AssertionError, expression2
-
-.. index::
-   single: __debug__
-   exception: AssertionError
-
-These equivalences assume that ``__debug__`` and :exc:`AssertionError` refer to
-the built-in variables with those names.  In the current implementation, the
-built-in variable ``__debug__`` is ``True`` under normal circumstances,
-``False`` when optimization is requested (command line option -O).  The current
-code generator emits no code for an assert statement when optimization is
-requested at compile time.  Note that it is unnecessary to include the source
-code for the expression that failed in the error message; it will be displayed
-as part of the stack trace.
-
-Assignments to ``__debug__`` are illegal.  The value for the built-in variable
-is determined when the interpreter starts.
-
-
 .. _assignment:
 
 Assignment statements
@@ -308,6 +266,48 @@
    a.x += 1     # writes a.x as 4 leaving A.x as 3
 
 
+.. _assert:
+
+The :keyword:`assert` statement
+===============================
+
+.. index::
+   statement: assert
+   pair: debugging; assertions
+
+Assert statements are a convenient way to insert debugging assertions into a
+program:
+
+.. productionlist::
+   assert_stmt: "assert" `expression` ["," `expression`]
+
+The simple form, ``assert expression``, is equivalent to ::
+
+   if __debug__:
+      if not expression: raise AssertionError
+
+The extended form, ``assert expression1, expression2``, is equivalent to ::
+
+   if __debug__:
+      if not expression1: raise AssertionError, expression2
+
+.. index::
+   single: __debug__
+   exception: AssertionError
+
+These equivalences assume that ``__debug__`` and :exc:`AssertionError` refer to
+the built-in variables with those names.  In the current implementation, the
+built-in variable ``__debug__`` is ``True`` under normal circumstances,
+``False`` when optimization is requested (command line option -O).  The current
+code generator emits no code for an assert statement when optimization is
+requested at compile time.  Note that it is unnecessary to include the source
+code for the expression that failed in the error message; it will be displayed
+as part of the stack trace.
+
+Assignments to ``__debug__`` are illegal.  The value for the built-in variable
+is determined when the interpreter starts.
+
+
 .. _pass:
 
 The :keyword:`pass` statement


More information about the Python-checkins mailing list