From 87bd34419795c8d6ff4ab0bba7db80cd6558764b Mon Sep 17 00:00:00 2001 From: Florian Freitag Date: Sun, 19 Jul 2026 12:26:26 +0200 Subject: [PATCH] Document getopt and gnu_getopt longopts argument as string (GH-153976) Document getopt and gnu_getopt longopts as string (cherry picked from commit 16562f1ce31ba654c42eee644f253bb31cff9f9d) Co-authored-by: Florian Freitag --- Doc/library/getopt.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/getopt.rst b/Doc/library/getopt.rst index 16ebb929f46002..db142e91ddce94 100644 --- a/Doc/library/getopt.rst +++ b/Doc/library/getopt.rst @@ -59,6 +59,8 @@ exception: option ``--fo`` will match as ``--foo``, but ``--f`` will not match uniquely, so :exc:`GetoptError` will be raised. + If *longopts* is a string it gets treated as a list of a single element. + The return value consists of two elements: the first is a list of ``(option, value)`` pairs; the second is the list of program arguments left after the option list was stripped (this is a trailing slice of *args*). Each