Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b185a04

Browse files
committed
#11926: add missing keywords to help("keywords").
1 parent 507cbc1 commit b185a04

3 files changed

Lines changed: 51 additions & 38 deletions

File tree

Lib/pydoc.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,9 @@ class Helper:
15381538
# in Doc/ and copying the output file into the Lib/ directory.
15391539

15401540
keywords = {
1541+
'False': '',
1542+
'None': '',
1543+
'True': '',
15411544
'and': 'BOOLEAN',
15421545
'as': 'with',
15431546
'assert': ('assert', ''),
@@ -1552,12 +1555,13 @@ class Helper:
15521555
'finally': 'try',
15531556
'for': ('for', 'break continue while'),
15541557
'from': 'import',
1555-
'global': ('global', 'NAMESPACES'),
1558+
'global': ('global', 'nonlocal NAMESPACES'),
15561559
'if': ('if', 'TRUTHVALUE'),
15571560
'import': ('import', 'MODULES'),
15581561
'in': ('in', 'SEQUENCEMETHODS'),
15591562
'is': 'COMPARISON',
15601563
'lambda': ('lambda', 'FUNCTIONS'),
1564+
'nonlocal': ('nonlocal', 'global NAMESPACES'),
15611565
'not': 'BOOLEAN',
15621566
'or': 'BOOLEAN',
15631567
'pass': ('pass', ''),
@@ -1652,7 +1656,7 @@ class Helper:
16521656
'NUMBERMETHODS': ('numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT '
16531657
'SPECIALMETHODS'),
16541658
'EXECUTION': ('execmodel', 'NAMESPACES DYNAMICFEATURES EXCEPTIONS'),
1655-
'NAMESPACES': ('naming', 'global ASSIGNMENT DELETION DYNAMICFEATURES'),
1659+
'NAMESPACES': ('naming', 'global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES'),
16561660
'DYNAMICFEATURES': ('dynamic-features', ''),
16571661
'SCOPING': 'NAMESPACES',
16581662
'FRAMES': 'NAMESPACES',
@@ -1752,6 +1756,9 @@ def help(self, request):
17521756
elif request[:8] == 'modules ':
17531757
self.listmodules(request.split()[1])
17541758
elif request in self.symbols: self.showsymbol(request)
1759+
elif request in ['True', 'False', 'None']:
1760+
# special case these keywords since they are objects too
1761+
doc(eval(request), 'Help on %s:')
17551762
elif request in self.keywords: self.showtopic(request)
17561763
elif request in self.topics: self.showtopic(request)
17571764
elif request: doc(request, 'Help on %s:')

0 commit comments

Comments
 (0)