Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def run(self):
'del', 'dict', 'dynamic-features', 'else', 'exceptions', 'execmodel',
'exprlists', 'floating', 'for', 'formatstrings', 'function', 'global',
'id-classes', 'identifiers', 'if', 'imaginary', 'import', 'in', 'integers',
'lambda', 'lists', 'naming', 'nonlocal', 'numbers', 'numeric-types',
'lambda', 'lists', 'match', 'naming', 'nonlocal', 'numbers', 'numeric-types',
'objects', 'operator-summary', 'pass', 'power', 'raise', 'return',
'sequence-types', 'shifting', 'slicings', 'specialattrs', 'specialnames',
'string-methods', 'strings', 'subscriptions', 'truth', 'try', 'types',
Expand Down
14 changes: 13 additions & 1 deletion 14 Lib/pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class or function within a module or module in a package. If the
import sysconfig
import time
import tokenize
import typing
import urllib.parse
import warnings
from collections import deque
Expand Down Expand Up @@ -1864,6 +1865,12 @@ class Helper:
'with': ('with', 'CONTEXTMANAGERS EXCEPTIONS yield'),
'yield': ('yield', ''),
}
soft_keywords = {
'_': '',
'case': 'match',
'match': ('match', ''),
'type': ''
}
# Either add symbols to this dictionary or to the symbols dictionary
# directly: Whichever is easier. They are merged later.
_strprefixes = [p + q for p in ('b', 'f', 'r', 'u') for q in ("'", '"')]
Expand Down Expand Up @@ -2070,6 +2077,10 @@ def help(self, request, is_cli=False):
# special case these keywords since they are objects too
doc(eval(request), 'Help on %s:', is_cli=is_cli)
elif request in self.keywords: self.showtopic(request)
elif request == 'type':
# special case for type alias
doc(typing.TypeAliasType, 'Help on %s:', is_cli=is_cli)
elif request in self.soft_keywords: self.showtopic(request)
elif request in self.topics: self.showtopic(request)
elif request: doc(request, 'Help on %s:', output=self._output, is_cli=is_cli)
else: doc(str, 'Help on %s:', output=self._output, is_cli=is_cli)
Expand Down Expand Up @@ -2140,7 +2151,8 @@ def showtopic(self, topic, more_xrefs=''):
module "pydoc_data.topics" could not be found.
''')
return
target = self.topics.get(topic, self.keywords.get(topic))
target = self.topics.get(topic, self.keywords.get(topic) or
self.soft_keywords.get(topic))
if not target:
self.output.write('no documentation found for %s\n' % repr(topic))
return
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.