Skip to content

Commit 2c34fba

Browse files
committed
__matmul__ shouldn't reference @ because of where help('@') currently goes
1 parent d11fb77 commit 2c34fba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/pydoc.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,6 @@ def collect_dunders(symbols):
19111911
'__add__': '+',
19121912
'__sub__': '-',
19131913
'__mul__': '*',
1914-
'__matmul__': '@',
19151914
'__truediv__': '/',
19161915
'__floordiv__': '//',
19171916
'__mod__': '%',
@@ -1931,6 +1930,12 @@ def collect_dunders(symbols):
19311930
if symbol in symbols:
19321931
symbols[symbol] += f' {dunder}'
19331932

1933+
# __matmul__ isn't included above because help('@') doesn't talk about
1934+
# matrix multiplication, so we shouldn't list it here as a related topic.
1935+
dunders['__matmul__'] = ('numeric-types', f'__rmatmul__ __imatmul__ SPECIALMETHODS')
1936+
dunders['__rmatmul__'] = ('numeric-types', f'__matmul__ SPECIALMETHODS')
1937+
dunders['__imatmul__'] = ('numeric-types', f'__matmul__ SPECIALMETHODS')
1938+
19341939
dunders['__divmod__'] = ('numeric-types', 'divmod')
19351940

19361941
return dunders

0 commit comments

Comments
 (0)