DAGDA SEARCH | Back to results | Support

6.7 The return statement

Source: https://docs.python.org/2.0/ref/return.html

Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 6.6 The print statement Up: 6. Simple statements Next: 6.8 The raise statement


6.7 The return statement

return_stmt:    "return" [expression_list]

return may only occur syntactically nested in a function definition, not within a nested class definition.

If an expression list is present, it is evaluated, else None is substituted.

return leaves the current function call with the expression list (or None) as return value.

When return passes control out of a try statement with a finally clause, that finally clause is executed before really leaving the function.


Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 6.6 The print statement Up: 6. Simple statements Next: 6.8 The raise statement


See About this document... for information on suggesting changes.