Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:58:22

0001 import dill
0002 import inspect
0003 
0004 
0005 def foo(arg1, arg2):
0006     # do something with args
0007     a = arg1 + arg2
0008     return a
0009 
0010 
0011 source_foo = inspect.getsource(foo)  # foo is normal function
0012 print(source_foo)
0013 
0014 
0015 # source_max = inspect.getsource(max)  # max is a built-in function
0016 # print(source_max)
0017 
0018 print(inspect.signature(foo))
0019 print(dill.dumps(foo))
0020 
0021 foo_str = dill.dumps(foo)
0022 foo_1 = dill.loads(foo_str)
0023 ret = foo_1(1, 3)
0024 print(ret)