Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
sage.misc.sageinspect.is_function_or_cython_function: Improve docstri…
Browse files Browse the repository at this point in the history
…ng markup
  • Loading branch information
Matthias Koeppe committed Sep 9, 2021
1 parent a03c459 commit f9154a9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/sage/misc/sageinspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,15 @@ def is_function_or_cython_function(obj):
"""
Check whether something is a function.
This is a variant of ``inspect.isfunction``:
This is a variant of :func:`inspect.isfunction`:
We assume that anything which has a genuine ``__code__``
attribute (not using ``__getattr__`` overrides) is a function.
This is meant to support Cython functions.
Think twice before using this function (or any function from the
``inspect`` or ``sage.misc.sageinspect`` modules. Most uses of
``isfunction`` in ordinary library code can be replaced by ``callable``.
:mod:`inspect` or :mod:`sage.misc.sageinspect` modules). Most uses of
:func:`inspect.isfunction` in ordinary library code can be replaced by
:func:`callable`.
EXAMPLES::
Expand All @@ -156,6 +157,8 @@ def is_function_or_cython_function(obj):
sage: is_function_or_cython_function(Integer(1).digits) # bound method
False
TESTS:
Verify that ipywidgets can correctly determine signatures of Cython
functions::
Expand Down

0 comments on commit f9154a9

Please sign in to comment.