Skip to content

Commit 1d55b37

Browse files
sobolevndzherbStanFromIreland
authored
gh-105895: Add match and case doc to help() (#152113)
Co-authored-by: dzherb <zherbin.dima@yandex.ru> Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent a52f428 commit 1d55b37

4 files changed

Lines changed: 7 additions & 2 deletions

File tree

Doc/tools/extensions/pydoc_topics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"lambda",
7171
"lazy",
7272
"lists",
73+
"match",
7374
"naming",
7475
"nonlocal",
7576
"numbers",

Lib/pydoc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,6 +1844,7 @@ class Helper:
18441844
'async': ('async', ''),
18451845
'await': ('await', ''),
18461846
'break': ('break', 'while for'),
1847+
'case': 'match',
18471848
'class': ('class', 'CLASSES SPECIALMETHODS'),
18481849
'continue': ('continue', 'while for'),
18491850
'def': ('function', ''),
@@ -1855,12 +1856,13 @@ class Helper:
18551856
'for': ('for', 'break continue while'),
18561857
'from': 'import',
18571858
'global': ('global', 'nonlocal NAMESPACES'),
1858-
'if': ('if', 'TRUTHVALUE'),
1859+
'if': ('if', 'TRUTHVALUE match'),
18591860
'import': ('import', 'MODULES'),
18601861
'in': ('in', 'SEQUENCEMETHODS'),
18611862
'is': 'COMPARISON',
18621863
'lambda': ('lambda', 'FUNCTIONS'),
18631864
'lazy': ('lazy', 'MODULES'),
1865+
'match': ('match', 'if'),
18641866
'nonlocal': ('nonlocal', 'global NAMESPACES'),
18651867
'not': 'BOOLEAN',
18661868
'or': 'BOOLEAN',

Lib/test/test_pydoc/test_pydoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2237,7 +2237,7 @@ def mock_getline(prompt):
22372237

22382238
def test_keywords(self):
22392239
self.assertEqual(sorted(pydoc.Helper.keywords),
2240-
sorted(keyword.kwlist + ['lazy']))
2240+
sorted(keyword.kwlist + ['case', 'match', 'lazy']))
22412241

22422242
def test_interact_empty_line_continues(self):
22432243
# gh-138568: test pressing Enter without input should continue in help session
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add :keyword:`match` and :keyword:`case` to the list of supported topics by
2+
:func:`help`.

0 commit comments

Comments
 (0)