Skip to content

Commit 0c0f04c

Browse files
committed
add __main__ and DUNDERMETHODS to help
1 parent 93ac0fa commit 0c0f04c

File tree

4 files changed

+1676
-334
lines changed

4 files changed

+1676
-334
lines changed

Doc/library/__main__.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _`__main__`:
2+
13
:mod:`!__main__` --- Top-level code environment
24
===============================================
35

Doc/tools/extensions/pydoc_topics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
"while",
101101
"with",
102102
"yield",
103+
"__main__",
103104
})
104105

105106

Lib/pydoc.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ class or function within a module or module in a package. If the
7878
from reprlib import Repr
7979
from traceback import format_exception_only
8080

81-
import _sitebuiltins
82-
8381
from _pyrepl.pager import (get_pager, pipe_pager,
8482
plain_pager, tempfile_pager, tty_pager)
8583

@@ -2023,6 +2021,9 @@ class Helper:
20232021
'TRUTHVALUE': ('truth', 'if while and or not BASICMETHODS'),
20242022
'DEBUGGING': ('debugger', 'pdb'),
20252023
'CONTEXTMANAGERS': ('context-managers', 'with'),
2024+
'DUNDERMETHODS': 'SPECIALMETHODS',
2025+
'MAINMODULE': '__main__',
2026+
'__main__': ('__main__', ''),
20262027
}
20272028

20282029
def __init__(self, input=None, output=None):
@@ -2173,7 +2174,7 @@ def listtopics(self):
21732174
Here is a list of available topics. Enter any topic name to get more help.
21742175
21752176
''')
2176-
self.list(self.topics.keys(), columns=3)
2177+
self.list([k for k in self.topics.keys() if k.isupper()], columns=3)
21772178

21782179
def showtopic(self, topic, more_xrefs=''):
21792180
try:

0 commit comments

Comments
 (0)