bundles / IPython 9.3.0 / IPython / core / magics / auto / AutoMagics / autocall
function
IPython.core.magics.auto:AutoMagics.autocall
source: /IPython/core/magics/auto.py :62
Signature
def autocall ( self , parameter_s = '' ) Summary
Make functions callable without having to type parentheses.
Extended Summary
Usage:
%autocall [mode]
The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the value is toggled on and off (remembering the previous state).
In more detail, these values mean:
0 -> fully disabled
1 -> active, but do not apply if there are no arguments on the line.
In this mode, you get
In [1]: callable Out[1]: <built-in function callable> In [2]: callable 'hello' ------> callable('hello') Out[2]: False
2 -> Active always. Even if no arguments are present, the callable object is called
In [2]: float ------> float() Out[2]: 0.0
Note that even with autocall off, you can still use '/' at the start of a line to treat the first argument on the command line as a function and add parentheses to it
In [8]: /str 43 ------> str(43) Out[8]: '43'
# all-random (note for auto-testing)
Aliases
-
IPython.core.magics.AutoMagics.autocall