From: Florian Freitag Date: Sun, 19 Jul 2026 10:26:26 +0000 (+0200) Subject: Document getopt and gnu_getopt longopts argument as string (#153976) X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=16562f1ce31ba654c42eee644f253bb31cff9f9d;p=thirdparty%2FPython%2Fcpython.git Document getopt and gnu_getopt longopts argument as string (#153976) Document getopt and gnu_getopt longopts as string --- diff --git a/Doc/library/getopt.rst b/Doc/library/getopt.rst index 5c63009e22d5..9995f114d063 100644 --- a/Doc/library/getopt.rst +++ b/Doc/library/getopt.rst @@ -62,6 +62,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