davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.29k stars 372 forks source link

Function signature displays type statements when library does not do that other wise #1123

Closed moorepants closed 5 months ago

moorepants commented 5 months ago

Issue

jedi-vim seems to include type logic in the function signature of the docstring when it should not* be present.

*probably depends on opinion

Steps to reproduce

install matplotlib

In a Python file in vim type:

from matplotlib.animation import FuncAnimation
FunctionAnimation()

shift-K on FuncAnimation() to view its docstring. This displays:

Docstring for class matplotlib.animation.FuncAnimation
======================================================
FuncAnimation(fig: Figure, func: Callable[..., Iterable[Artist]], frames: Iterable[Artist] | int | Callable[[], Generator] | None=..., init_func: Callable[[], Iterable[Artist]] | None=..., fargs: tuple[Any, ...] | None=..., save_count: int | None=..., *, cache_frame_data: bool=..., **kwargs)

`TimedAnimation` subclass that makes an animation by repeatedly calling
a function *func*.

.. note::

    You must store the created Animation in a variable that lives as long
    as the animation should run. Otherwise, the Animation object will be
    garbage-collected and the animation stops.

<more>

Open Python and type:

from matplotlib.animation import FunctionAnimation
help(FuncAnimation)

This displays:

Help on class FuncAnimation in module matplotlib.animation:

class FuncAnimation(TimedAnimation)
 |  FuncAnimation(fig, func, frames=None, init_func=None, fargs=None, save_count=None, *, cache_frame_data=True, **kwargs)
 |  
 |  `TimedAnimation` subclass that makes an animation by repeatedly calling
 |  a function *func*.
 |  
 |  .. note::
 |  
 |      You must store the created Animation in a variable that lives as long
 |      as the animation should run. Otherwise, the Animation object will be
 |      garbage-collected and the animation stops.

Note that matplotlib does not display the complex type logic in their docstring, which keeps it readable (IMHO). It seems that jedi-vim may inject a different function signature (not sure, just a guess).

I would prefer to see what help() shows, in this case. Can we disable overwriting function signatures with type logic? Or maybe this is unintentional on jedi-vim's side?

You can see that matplotlib does not include this in their docstring here:

https://github.com/matplotlib/matplotlib/blob/5b36d02f796e212c44932c37ed75a0655473f3ac/lib/matplotlib/animation.py#L1527

Note that this more complex type logic also is displayed in the jedi-vim popups that show the function signature. In that case, it is even more difficult to make sense of since it makes the function signature so long and the popup only displays the first characters of it.

Output of “:verbose JediDebugInfo”

You should run this in a buffer with filetype "python".

Jedi-vim debug information

jedi-vim version
Global Python

Using Python version 3 to access Jedi.

Jedi
Jedi environment: <SameEnvironment: 3.11.8 in /home/moorepants/miniconda>
Known environments
Settings
g:jedi#popup_on_dot = 0 (default: 1)

  omnifunc=
  completeopt=menuone,longest,popup
    Last set from ~/.vim/bundle/jedi-vim/plugin/jedi.vim line 38

:version


VIM - Vi IMproved 9.1 (2024 Jan 02, compiled May 03 2024 02:45:42)
Included patches: 1-16
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +cmdline_compl     +emacs_tags        +insert_expand     +mksession         -mzscheme          +reltime           -tag_old_static    +vertsplit         +xim
+arabic            +cmdline_hist      +eval              +ipv6              +modify_fname      +netbeans_intg     +rightleft         -tag_any_white     +vim9script        -xpm
+autocmd           +cmdline_info      +ex_extra          +job               +mouse             +num64             +ruby              +tcl               +viminfo           +xsmp_interact
+autochdir         +comments          +extra_search      +jumplist          +mouseshape        +packages          +scrollbind        +termguicolors     +virtualedit       +xterm_clipboard
-autoservername    +conceal           -farsi             +keymap            +mouse_dec         +path_extra        +signs             +terminal          +visual            -xterm_save
+balloon_eval      +cryptv            +file_in_path      +lambda            +mouse_gpm         +perl              +smartindent       +terminfo          +visualextra       
+balloon_eval_term +cscope            +find_in_path      +langmap           -mouse_jsbterm     +persistent_undo   +sodium            +termresponse      +vreplace          
+browse            +cursorbind        +float             +libcall           +mouse_netterm     +popupwin          +sound             +textobjects       +wildignore        
++builtin_terms    +cursorshape       +folding           +linebreak         +mouse_sgr         +postscript        +spell             +textprop          +wildmenu          
+byte_offset       +dialog_con_gui    -footer            +lispindent        -mouse_sysmouse    +printer           +startuptime       +timers            +windows           
+channel           +diff              +fork()            +listcmds          +mouse_urxvt       +profile           +statusline        +title             +writebackup       
+cindent           +digraphs          +gettext           +localmap          +mouse_xterm       -python            -sun_workshop      +toolbar           +X11               
+clientserver      +dnd               -hangul_input      +lua               +multi_byte        +python3           +syntax            +user_commands     +xattr             
+clipboard         -ebcdic            +iconv             +menu              +multi_lang        +quickfix          +tag_binary        +vartabs           -xfontset          
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/vim/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/webp -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -pthread -Wdate-time -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/build/vim-QkysrQ/vim-9.1.0016=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/build/vim-QkysrQ/vim-9.1.0016=/usr/src/vim-2:9.1.0016-1ubuntu7.1 -DSYS_VIMRC_FILE=\"/etc/vim/vimrc\" -DSYS_GVIMRC_FILE=\"/etc/vim/gvimrc\" -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -Wl,-E -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lselinux -lcanberra -lsodium -lacl -lattr -lgpm -L/usr/lib -llua5.1 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.38/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.12/config-3.12-x86_64-linux-gnu -lpython3.12 -ldl -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-3.2 -lm -lpthread -L/usr/lib 

:messages

Messages maintainer: The Vim Project
"examples-gallery/plot_one_legged_time_trial.py" 706L, 24463B
12 lines yanked into "+
:scriptnames ``` 1: /etc/vim/vimrc 2: /usr/share/vim/vim91/debian.vim 3: /usr/share/vim/vim91/syntax/syntax.vim 4: /usr/share/vim/vim91/syntax/synload.vim 5: /usr/share/vim/vim91/syntax/syncolor.vim 6: /usr/share/vim/vim91/colors/lists/default.vim 7: /usr/share/vim/vim91/filetype.vim 8: /usr/share/vim/vim91/syntax/python.vim 9: ~/.vimrc 10: /usr/share/vim/vim91/ftoff.vim 11: ~/.vim/bundle/Vundle.vim/autoload/vundle.vim 12: ~/.vim/bundle/Vundle.vim/autoload/vundle/config.vim 13: /usr/share/vim/vim91/syntax/nosyntax.vim 14: ~/.vim/bundle/vimtex/ftdetect/cls.vim 15: ~/.vim/bundle/vimtex/ftdetect/tex.vim 16: ~/.vim/bundle/vimtex/ftdetect/tikz.vim 17: ~/.vim/bundle/vim-pcgen/ftdetect/pcgen.vim 18: ~/.vim/bundle/vim-fugitive/ftdetect/fugitive.vim 19: ~/.vim/bundle/python-mode/syntax/python.vim 20: ~/.vim/bundle/python-mode/autoload/pymode.vim 21: ~/.vim/bundle/jedi-vim/after/syntax/python.vim 22: ~/.vim/bundle/jedi-vim/autoload/jedi.vim 23: /usr/share/vim/vim91/ftplugin.vim 24: /usr/share/vim/vim91/indent.vim 25: ~/.vim/bundle/jedi-vim/plugin/jedi.vim 26: ~/.vim/bundle/vim-slime/plugin/slime.vim 27: ~/.vim/bundle/vim-slime/autoload/slime/config.vim 28: ~/.vim/bundle/vimtex/plugin/vimtex.vim 29: ~/.vim/bundle/vim-jinja/plugin/htmljinja.vim 30: ~/.vim/bundle/nerdtree/plugin/NERD_tree.vim 31: ~/.vim/bundle/nerdtree/autoload/nerdtree.vim 32: ~/.vim/bundle/nerdtree/lib/nerdtree/path.vim 33: ~/.vim/bundle/nerdtree/lib/nerdtree/menu_controller.vim 34: ~/.vim/bundle/nerdtree/lib/nerdtree/menu_item.vim 35: ~/.vim/bundle/nerdtree/lib/nerdtree/key_map.vim 36: ~/.vim/bundle/nerdtree/lib/nerdtree/bookmark.vim 37: ~/.vim/bundle/nerdtree/lib/nerdtree/tree_file_node.vim 38: ~/.vim/bundle/nerdtree/lib/nerdtree/tree_dir_node.vim 39: ~/.vim/bundle/nerdtree/lib/nerdtree/opener.vim 40: ~/.vim/bundle/nerdtree/lib/nerdtree/creator.vim 41: ~/.vim/bundle/nerdtree/lib/nerdtree/flag_set.vim 42: ~/.vim/bundle/nerdtree/lib/nerdtree/nerdtree.vim 43: ~/.vim/bundle/nerdtree/lib/nerdtree/ui.vim 44: ~/.vim/bundle/nerdtree/lib/nerdtree/event.vim 45: ~/.vim/bundle/nerdtree/lib/nerdtree/notifier.vim 46: ~/.vim/bundle/nerdtree/autoload/nerdtree/ui_glue.vim 47: ~/.vim/bundle/nerdtree/nerdtree_plugin/exec_menuitem.vim 48: ~/.vim/bundle/nerdtree/nerdtree_plugin/fs_menu.vim 49: ~/.vim/bundle/nerdtree/nerdtree_plugin/vcs.vim 50: ~/.vim/bundle/python-mode/plugin/pymode.vim 51: ~/.vim/bundle/vim-fugitive/plugin/fugitive.vim 52: ~/.vim/bundle/ToggleComment/plugin/ToggleComment.vim 53: ~/.vim/bundle/taglist.vim/plugin/taglist.vim 54: /usr/share/vim/vim91/plugin/getscriptPlugin.vim 55: /usr/share/vim/vim91/plugin/gzip.vim 56: /usr/share/vim/vim91/plugin/logiPat.vim 57: /usr/share/vim/vim91/plugin/manpager.vim 58: /usr/share/vim/vim91/plugin/matchparen.vim 59: /usr/share/vim/vim91/plugin/netrwPlugin.vim 60: /usr/share/vim/vim91/plugin/rrhelper.vim 61: /usr/share/vim/vim91/plugin/spellfile.vim 62: /usr/share/vim/vim91/plugin/tarPlugin.vim 63: /usr/share/vim/vim91/plugin/tohtml.vim 64: /usr/share/vim/vim91/plugin/vimballPlugin.vim 65: /usr/share/vim/vim91/plugin/zipPlugin.vim 66: ~/.vim/bundle/jedi-vim/ftplugin/python/jedi.vim 67: ~/.vim/bundle/vim-slime/ftplugin/python/slime.vim 68: ~/.vim/bundle/python-mode/ftplugin/python/pymode.vim 69: ~/.vim/bundle/python-mode/autoload/pymode/virtualenv.vim 70: ~/.vim/bundle/python-mode/autoload/pymode/breakpoint.vim 71: /usr/share/vim/vim91/ftplugin/python.vim 72: ~/.vim/after/ftplugin/python.vim 73: ~/.vim/bundle/jedi-vim/after/ftplugin/python/jedi.vim 74: ~/.vim/bundle/python-mode/after/ftplugin/python.vim 75: /usr/share/vim/vim91/indent/python.vim 76: ~/.vim/bundle/python-mode/after/indent/python.vim 77: ~/.vim/bundle/python-mode/autoload/pymode/lint.vim 78: ~/.vim/bundle/python-mode/autoload/pymode/tools/signs.vim 79: ~/.vim/bundle/python-mode/autoload/pymode/tools/loclist.vim 80: /usr/share/vim/vim91/scripts.vim 81: /usr/share/vim/vim91/autoload/dist/script.vim 82: /usr/share/vim/vim91/syntax/rst.vim 83: /usr/share/vim/vim91/syntax/vim.vim 84: /usr/share/vim/vim91/syntax/lua.vim 85: /usr/share/vim/vim91/syntax/perl.vim 86: /usr/share/vim/vim91/syntax/pod.vim 87: /usr/share/vim/vim91/syntax/ruby.vim 88: /usr/share/vim/vim91/syntax/sh.vim 89: /usr/share/vim/vim91/syntax/php.vim 90: /usr/share/vim/vim91/syntax/html.vim 91: /usr/share/vim/vim91/syntax/xml.vim 92: /usr/share/vim/vim91/syntax/dtd.vim 93: /usr/share/vim/vim91/syntax/javascript.vim 94: /usr/share/vim/vim91/syntax/vb.vim 95: /usr/share/vim/vim91/syntax/css.vim 96: /usr/share/vim/vim91/syntax/sql.vim 97: /usr/share/vim/vim91/syntax/sqloracle.vim 98: /usr/share/vim/vim91/syntax/java.vim 99: /usr/share/vim/vim91/syntax/cpp.vim 100: /usr/share/vim/vim91/syntax/c.vim 101: /usr/share/vim/vim91/syntax/lisp.vim 102: ~/.vim/bundle/vim-slime/ftplugin/rst/slime.vim 103: /usr/share/vim/vim91/ftplugin/rst.vim 104: ~/.vim/after/ftplugin/rst.vim 105: /usr/share/vim/vim91/indent/rst.vim 106: /usr/share/vim/vim91/ftplugin/vim.vim 107: /usr/share/vim/vim91/indent/vim.vim 108 A: /usr/share/vim/vim91/autoload/dist/vimindent.vim ```
moorepants commented 5 months ago

Maybe this issue should have been open in the main jedi repo, as I see that it also affects Spyder (note the different function signatures shown in the console and the hover popup): Screenshot from 2024-06-16 07-42-43

davidhalter commented 5 months ago

The signature comes from https://github.com/matplotlib/matplotlib/blob/b3d29fb036b0d9de2fb66ee7bcad6887654b3706/lib/matplotlib/animation.pyi#L205

I personally think that these signatures are in general very helpful. Even in this context I feel like I would prefer it. This is the signature that matplotlib devs guarantee us (and it is probably type checked internally).

We could potentially come up with a configuration option that disables type annotations in these strings, but I don't like to support that and it's quite a bit of extra work, so I will simply close this issue. I appreciate the way how you asked for this, but this is probably a minority opinion if you consider all cases and not just matplotlib and it's just extra work and maintenance that I don't like to do. Sorry.

FYI: If you want a very quick workaround, you can simply delete the relevant .pyi files. This might however have other consequences for type inference.

moorepants commented 5 months ago

Thanks for your consideration.

moorepants commented 4 months ago

I know you've closed this but I came across this in NumPy's linspace function (from shift + K) and felt it was at least worth reporting:

Docstring for function numpy.core.function_base.linspace
========================================================
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[complexfloating[Any, Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: _DTypeLike[_SCT]=..., axis: SupportsIndex=...) -> NDArray[_SCT]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: DTypeLike=..., axis: SupportsIndex=...) -> NDArray[Any]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: None=..., axis: SupportsIndex=...) -> tuple[NDArray[floating[Any]], floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: None=..., axis: SupportsIndex=...) -> tuple[NDArray[complexfloating[Any, Any]], complexfloating[Any, Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: _DTypeLike[_SCT]=..., axis: SupportsIndex=...) -> tuple[NDArray[_SCT], _SCT]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: DTypeLike=..., axis: SupportsIndex=...) -> tuple[NDArray[Any], Any]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[complexfloating[Any, Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: _DTypeLike[_SCT]=..., axis: SupportsIndex=...) -> NDArray[_SCT]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: DTypeLike=..., axis: SupportsIndex=...) -> NDArray[Any]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: None=..., axis: SupportsIndex=...) -> tuple[NDArray[floating[Any]], floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: None=..., axis: SupportsIndex=...) -> tuple[NDArray[complexfloating[Any, Any]], complexfloating[Any, Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: _DTypeLike[_SCT]=..., axis: SupportsIndex=...) -> tuple[NDArray[_SCT], _SCT]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[complexfloating[Any, Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: _DTypeLike[_SCT]=..., axis: SupportsIndex=...) -> NDArray[_SCT]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: DTypeLike=..., axis: SupportsIndex=...) -> NDArray[Any]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: None=..., axis: SupportsIndex=...) -> tuple[NDArray[floating[Any]], floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: None=..., axis: SupportsIndex=...) -> tuple[NDArray[complexfloating[Any, Any]], complexfloating[Any, Any]]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[complexfloating[Any, Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: _DTypeLike[_SCT]=..., axis: SupportsIndex=...) -> NDArray[_SCT]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: DTypeLike=..., axis: SupportsIndex=...) -> NDArray[Any]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[True]=..., dtype: None=..., axis: SupportsIndex=...) -> tuple[NDArray[floating[Any]], floating[Any]]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[complexfloating[Any, Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: _DTypeLike[_SCT]=..., axis: SupportsIndex=...) -> NDArray[_SCT]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: DTypeLike=..., axis: SupportsIndex=...) -> NDArray[Any]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[complexfloating[Any, Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: _DTypeLike[_SCT]=..., axis: SupportsIndex=...) -> NDArray[_SCT]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[floating[Any]]
linspace(start: _ArrayLikeComplex_co, stop: _ArrayLikeComplex_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[complexfloating[Any, Any]]
linspace(start: _ArrayLikeFloat_co, stop: _ArrayLikeFloat_co, num: SupportsIndex=..., endpoint: bool=..., retstep: L[False]=..., dtype: None=..., axis: SupportsIndex=...) -> NDArray[floating[Any]]

Return evenly spaced numbers over a specified interval.

Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].

The endpoint of the interval can optionally be excluded.

.. versionchanged:: 1.16.0
    Non-scalar `start` and `stop` are now supported.

.. versionchanged:: 1.20.0
    Values are rounded towards ``-inf`` instead of ``0`` when an
    integer ``dtype`` is specified. The old behavior can
    still be obtained with ``np.linspace(start, stop, num).astype(int)``

...

The first 38 lines are not so easy to read and the popup that occurs when typing the linspace function also shows these lines.

image

This can be compared with the doctring shown with help():

linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0, *, device=None)
    Return evenly spaced numbers over a specified interval.

    Returns `num` evenly spaced samples, calculated over the
    interval [`start`, `stop`].

...
davidhalter commented 4 months ago

Thanks for letting me know.