~ubuntu-branches/ubuntu/precise/python3.2/precise-proposed

« back to all changes in this revision

Viewing changes to Doc/reference/compound_stmts.rst

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-09 18:40:39 UTC
  • mfrom: (30.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120309184039-j3yk2emxr1plyo21
Tags: 3.2.3~rc1-1
* Python 3.2.3 release candidate 1.
* Update to 20120309 from the 3.2 branch.
* Fix libpython.a symlink. Closes: #660146.
* Build-depend on xauth.
* Run the gdb tests for the debug build only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
310
310
is executed.  If there is a saved exception, it is re-raised at the end of the
311
311
:keyword:`finally` clause. If the :keyword:`finally` clause raises another
312
312
exception or executes a :keyword:`return` or :keyword:`break` statement, the
313
 
saved exception is lost.  The exception information is not available to the
314
 
program during execution of the :keyword:`finally` clause.
 
313
saved exception is set as the context of the new exception.  The exception
 
314
information is not available to the program during execution of the
 
315
:keyword:`finally` clause.
315
316
 
316
317
.. index::
317
318
   statement: return
427
428
.. productionlist::
428
429
   funcdef: [`decorators`] "def" `funcname` "(" [`parameter_list`] ")" ["->" `expression`] ":" `suite`
429
430
   decorators: `decorator`+
430
 
   decorator: "@" `dotted_name` ["(" [`argument_list` [","]] ")"] NEWLINE
 
431
   decorator: "@" `dotted_name` ["(" [`parameter_list` [","]] ")"] NEWLINE
431
432
   dotted_name: `identifier` ("." `identifier`)*
432
433
   parameter_list: (`defparameter` ",")*
433
434
                 : (  "*" [`parameter`] ("," `defparameter`)*
478
479
 
479
480
**Default parameter values are evaluated when the function definition is
480
481
executed.** This means that the expression is evaluated once, when the function
481
 
is defined, and that that same "pre-computed" value is used for each call.  This
 
482
is defined, and that the same "pre-computed" value is used for each call.  This
482
483
is especially important to understand when a default parameter is a mutable
483
484
object, such as a list or a dictionary: if the function modifies the object
484
485
(e.g. by appending an item to a list), the default value is in effect modified.
554
555
 
555
556
.. productionlist::
556
557
   classdef: [`decorators`] "class" `classname` [`inheritance`] ":" `suite`
557
 
   inheritance: "(" [`argument_list` [","] | `comprehension`] ")"
 
558
   inheritance: "(" [`parameter_list`] ")"
558
559
   classname: `identifier`
559
560
 
560
561
A class definition is an executable statement.  The inheritance list usually