Name
__call__
Synopsis
__call__(self[,args
...])
When you call
x
(
[args...]
)
,
Python translates the operation into a call to
x
.__call__(
[args...]
)
.
The formal arguments for the call operation are the same as for the
__call__
method, minus the first argument. The
first argument, conventionally called self
, refers
to x
, and Python supplies it implicitly
and automatically, just as in any other call to a bound method.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.