There was an error while loading. Please reload this page.
match
case
help()
1 parent a52f428 commit 1d55b37Copy full SHA for 1d55b37
4 files changed
Doc/tools/extensions/pydoc_topics.py
@@ -70,6 +70,7 @@
70
"lambda",
71
"lazy",
72
"lists",
73
+ "match",
74
"naming",
75
"nonlocal",
76
"numbers",
Lib/pydoc.py
@@ -1844,6 +1844,7 @@ class Helper:
1844
'async': ('async', ''),
1845
'await': ('await', ''),
1846
'break': ('break', 'while for'),
1847
+ 'case': 'match',
1848
'class': ('class', 'CLASSES SPECIALMETHODS'),
1849
'continue': ('continue', 'while for'),
1850
'def': ('function', ''),
@@ -1855,12 +1856,13 @@ class Helper:
1855
1856
'for': ('for', 'break continue while'),
1857
'from': 'import',
1858
'global': ('global', 'nonlocal NAMESPACES'),
- 'if': ('if', 'TRUTHVALUE'),
1859
+ 'if': ('if', 'TRUTHVALUE match'),
1860
'import': ('import', 'MODULES'),
1861
'in': ('in', 'SEQUENCEMETHODS'),
1862
'is': 'COMPARISON',
1863
'lambda': ('lambda', 'FUNCTIONS'),
1864
'lazy': ('lazy', 'MODULES'),
1865
+ 'match': ('match', 'if'),
1866
'nonlocal': ('nonlocal', 'global NAMESPACES'),
1867
'not': 'BOOLEAN',
1868
'or': 'BOOLEAN',
Lib/test/test_pydoc/test_pydoc.py
@@ -2237,7 +2237,7 @@ def mock_getline(prompt):
2237
2238
def test_keywords(self):
2239
self.assertEqual(sorted(pydoc.Helper.keywords),
2240
- sorted(keyword.kwlist + ['lazy']))
+ sorted(keyword.kwlist + ['case', 'match', 'lazy']))
2241
2242
def test_interact_empty_line_continues(self):
2243
# gh-138568: test pressing Enter without input should continue in help session
Misc/NEWS.d/next/Library/2026-06-24-22-16-35.gh-issue-105895.hRkuEw.rst
@@ -0,0 +1,2 @@
1
+Add :keyword:`match` and :keyword:`case` to the list of supported topics by
2
+:func:`help`.
0 commit comments