We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a5e9ad6 commit dad423cCopy full SHA for dad423c
Python.adoc
@@ -100,6 +100,28 @@ def write_temp_file(content):
100
return path
101
----
102
103
+=== Calling method or function by name
104
+
105
+* Calling method:
106
++
107
+[source,python,linenums]
108
+----
109
+bar = getattr(foo, 'bar')
110
+result = method(arg_1, arg_2)
111
112
113
+* Calling function:
114
115
116
117
+locals()["myfunction"]()
118
+# or
119
+globals()["myfunction"]()
120
121
122
+`locals` returns a dictionary containing local symbol table. `globals`
123
+returns a dictionary with global symbol table.
124
125
=== Trapping `Ctrl-C` but not SIGTERM
126
127
By using `KeyboardInterrupt` exception:
0 commit comments