-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Description
Python 3.11.10 | packaged by conda-forge | (main, Oct 16 2024, 01:27:36) [GCC 13.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.31.0.dev -- An enhanced Interactive Python. Type '?' for help.
In [1]: %load_ext cython
In [2]: %%cython
...: # cython: binding=False, embedsignature=True
...: cpdef int f(int a):
...: """
...: help
...: """
...: return a+1
In [3]: f.__doc__
Out[3]: 'f(int a) -> int\n\n\thelp\n\t'
In [4]: print(f.__doc__)
f(int a) -> int
help
In [5]: f?
Docstring:
f(int a) -> int
help
Type: builtin_function_or_method
In [6]:
Here the f(int a) -> int
part is displayed as a separate line in the docstring. Ideally it could be displayed with Signature:
like Python function
In [6]: def g(a):
...: return a+1
In [7]: g?
Signature: g(a)
Docstring: <no docstring>
File: ~/sage/<ipython-input-6-05673b5dcfb4>
Type: function
Context: SageMath uses a monkey-patch to pretty-print it, but ideally IPython supports it natively,
or at least allow it to be overridden without the monkey-patch.
Metadata
Metadata
Assignees
Labels
No labels