Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé
Module « scipy »

Classe « LowLevelCallable »

Informations générales

Héritage

builtins.object
    builtins.tuple
        LowLevelCallable

Définition

class LowLevelCallable(builtins.tuple):

help(LowLevelCallable)

Low-level callback function.

Some functions in SciPy take as arguments callback functions, which
can either be python callables or low-level compiled functions. Using
compiled callback functions can improve performance somewhat by
avoiding wrapping data in Python objects.

Such low-level functions in SciPy are wrapped in `LowLevelCallable`
objects, which can be constructed from function pointers obtained from
ctypes, cffi, Cython, or contained in Python `PyCapsule` objects.

.. seealso::

   Functions accepting low-level callables:

   `scipy.integrate.quad`, `scipy.ndimage.generic_filter`,
   `scipy.ndimage.generic_filter1d`, `scipy.ndimage.geometric_transform`

   Usage examples:

   :ref:`ndimage-ccallbacks`, :ref:`quad-callbacks`

Parameters
----------
function : {PyCapsule, ctypes function pointer, cffi function pointer}
    Low-level callback function.
user_data : {PyCapsule, ctypes void pointer, cffi void pointer}
    User data to pass on to the callback function.
signature : str, optional
    Signature of the function. If omitted, determined from *function*,
    if possible.

Attributes
----------
function
    Callback function given.
user_data
    User data given.
signature
    Signature of the function.

Methods
-------
from_cython
    Class method for constructing callables from Cython C-exported
    functions.

Notes
-----
The argument ``function`` can be one of:

- PyCapsule, whose name contains the C function signature
- ctypes function pointer
- cffi function pointer

The signature of the low-level callback must match one of those expected
by the routine it is passed to.

If constructing low-level functions from a PyCapsule, the name of the
capsule must be the corresponding signature, in the format::

    return_type (arg1_type, arg2_type, ...)

For example::

    "void (double)"
    "double (double, int *, void *)"

The context of a PyCapsule passed in as ``function`` is used as ``user_data``,
if an explicit value for ``user_data`` was not given.

Constructeur(s)

Signature du constructeur Description
__new__(cls, function, user_data=None, signature=None)
__init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. [extrait de __init__.__doc__]

Liste des propriétés

Nom de la propriétéDescription
function
signature
user_data

Liste des opérateurs

Signature de l'opérateur Description
__getitem__(self, idx)

Opérateurs hérités de la classe tuple

__add__, __contains__, __eq__, __ge__, __gt__, __le__, __lt__, __mul__, __ne__, __rmul__

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__class_getitem__(object) See PEP 585 [extrait de __class_getitem__.__doc__]
__repr__(self)
from_cython(module, name, user_data=None, signature=None)

Méthodes héritées de la classe tuple

__getattribute__, __getnewargs__, __hash__, __init_subclass__, __iter__, __len__, __subclasshook__, count, index

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __init_subclass__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé