Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Pass a function by its name, without parentheses, then call the parameter inside the receiving function. For example, apply(double, 3) passes the function object; apply(double(3), 3) calls double first and passes its result instead.
Pass the function, then call it inside the receiver
A function is a value in Python. Giving its name as an argument passes the function itself, which the receiving function can invoke later.
As an Amazon Associate I earn from qualifying purchases.
from collections.abc import Callable
def double(value: int) -> int:
return value * 2
def apply(fn: Callable[[int], int], value: int) -> int:
return fn(value)
result = apply(double, 3) # 6
In apply(double, 3), double has no parentheses, so it is not called at the point of passing. The receiver invokes it with fn(value). By contrast, apply(double(3), 3) evaluates double(3) immediately and passes the resulting integer, not a callable; that does not satisfy this receiver’s contract.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Define what the callback is expected to do
Give the parameter a descriptive name such as transform, predicate, or on_complete. State which arguments the receiver will supply and what it expects in return, or whether it expects a side effect. The callback must accept the arguments used at its call site; a mismatch appears when Python invokes it.
#1 Best Overall
def run_twice(fn, value):
return fn(fn(value))
run_twice(double, 3) # Passes double; invokes it twice
Here the receiver calls fn first with value, then with that call’s result. The callback therefore needs to accept the value type it receives on both calls.
Functions, methods, and callable objects all work
Pass a bound method
An instance method accessed through an object, such as worker.process, is a bound method and can be passed just like a function. When called, it already supplies worker as the method’s first argument. Passing Worker.process through the class instead gives the underlying function reference; callers normally supply the instance explicitly.
Rank #2
Pass a callable instance
An instance whose class defines __call__ supports call syntax and can be used as a callback. This is useful when the callback needs to keep state in an object rather than in a function’s surrounding scope.
Annotate the callback when useful
For a fixed list of positional argument types and a return type, use collections.abc.Callable in new annotations. Python’s typing documentation describes Callable[[int], str] as a callable that takes one integer and returns a string; it documents typing.Callable as deprecated. See the Python 3.14 typing documentation.
from collections.abc import Callable
def transform_all(
values: list[int],
transform: Callable[[int], str],
) -> list[str]:
return [transform(value) for value in values]
Callable[..., R] describes a callable with an arbitrary parameter list and return type R, but ordinary Callable cannot fully express keyword-only parameters, overloads, or some variadic signatures. For a callback whose keyword names or parameter kinds are part of its contract, describe its __call__ method with a protocol:
from typing import Protocol
class Combiner(Protocol):
def __call__(
self, *values: bytes, maxlen: int | None = None
) -> list[bytes]: ...
ParamSpec and Concatenate can help type higher-order functions that forward or add parameters. The typing documentation notes support for these in Callable from Python 3.10; type-checker support and syntax details depend on the Python and typing versions in use.
Adapt a callback or bind arguments in advance
If a callback has the wrong shape for the receiver, adapt it with a small lambda or a named wrapper. To pre-fill some arguments, use functools.partial:
from functools import partial
def multiply(value: int, factor: int) -> int:
return value * factor
double = partial(multiply, factor=2)
To inspect a callable's signature or check proposed arguments, use inspect.signature(callable) and Signature.bind. The Python 3.14 inspect documentation notes that signatures are available for many callable types, including functools.partial, though some built-ins do not expose enough metadata to inspect.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




