ID EN
Multiprocessing

_callmethod

Python 3.11

Call and return the result of a method of the proxy’s referent.

Syntax

PYTHON
_callmethod(methodname[, args[, kwds]])

Examples

Example 1
PYTHON
proxy._callmethod(methodname, args, kwds)
Example 2
PYTHON
getattr(obj, methodname)(*args, **kwds)
Example 3
PYTHON
>>> l = manager.list(range(10))
>>> l._callmethod('__len__')
10
>>> l._callmethod('__getitem__', (slice(2, 7),))  equivalent to l[2:7]
[2, 3, 4, 5, 6]
>>> l._callmethod('__getitem__', (20,))           equivalent to l[20]
Traceback (most recent call last):
...
IndexError: list index out of range

See Also

BaseManager.register() _callmethod() _callmethod() _callmethod()