Next: The raise statement Up: Simple statements Previous: The print statement

The return statement


return_stmt:    "return" [condition_list]

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

If a condition list is present, it is evaluated, else None is substituted.

return leaves the current function call with the condition 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.


guido@cwi.nl