]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] Document getopt and gnu_getopt longopts argument as string (GH-153976) (#154097)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 19 Jul 2026 11:16:21 +0000 (13:16 +0200)
committerGitHub <noreply@github.com>
Sun, 19 Jul 2026 11:16:21 +0000 (13:16 +0200)
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 <flohacksfriday@gmail.com>
Doc/library/getopt.rst

index 16ebb929f4600236d541e5829f85e7fbf861b74d..db142e91ddce94c8828b19ebc02638ac9af41259 100644 (file)
@@ -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