From 0c595ce10238070632453a53970205cddbc26ec9 Mon Sep 17 00:00:00 2001 From: "@x0mg" Date: Fri, 5 Sep 2025 15:27:39 +0800 Subject: [PATCH] Doc: clarify ordering rule for default parameters in tutorial --- Doc/tutorial/controlflow.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index 6d4928f211a69d..c77cc5e6198d0c 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -587,9 +587,10 @@ There are three forms, which can be combined. Default Argument Values ----------------------- -The most useful form is to specify a default value for one or more arguments. -This creates a function that can be called with fewer arguments than it is -defined to allow. For example:: +The most useful form is to specify a default value for one or more parameters. +All positional only parameters (that is, without default values) must come +first, followed by those with defaults. This allows a function to be called +with fewer arguments than it is defined to allow. For example:: def ask_ok(prompt, retries=4, reminder='Please try again!'): while True: