From 297f3af6ed2511ae9023f6d8f284f240e9772742 Mon Sep 17 00:00:00 2001 From: John Marshall Date: Wed, 13 Nov 2024 11:48:50 +1300 Subject: [PATCH 1/2] Document that return-less user-defined functions return None --- Doc/reference/expressions.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index decde0d297cf59..e9ff17529a55af 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1156,7 +1156,8 @@ a user-defined function: first thing the code block will do is bind the formal parameters to the arguments; this is described in section :ref:`function`. When the code block executes a :keyword:`return` statement, this specifies the return value of the - function call. + function call. If execution falls off the end of the code block without + executing a :keyword:`return` statement, the return value is ``None``. a built-in function or method: .. index:: From f676fc09f69aefeec31c8475de13480942440007 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 14 Nov 2024 08:15:18 +0100 Subject: [PATCH 2/2] Update Doc/reference/expressions.rst Co-authored-by: Carol Willing --- Doc/reference/expressions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index e9ff17529a55af..3eaceae41f7eaf 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1156,7 +1156,7 @@ a user-defined function: first thing the code block will do is bind the formal parameters to the arguments; this is described in section :ref:`function`. When the code block executes a :keyword:`return` statement, this specifies the return value of the - function call. If execution falls off the end of the code block without + function call. If execution reaches the end of the code block without executing a :keyword:`return` statement, the return value is ``None``. a built-in function or method: