Run isolated functions inside a Python script as though invoked via a command line interface.
With a Python file as follows:
# example.py
def root(n, exp=2):
return n ** (1/exp)
def foo(is_happy):
if is_happy:
print(":)")
else:
print(":(")The functions can be executed from the command line as follows:
qwe example.py root 8 --exp 3
2.0
qwe example.py True
:)