This paste expires on 2023-05-23 20:27:49.023288. Repaste, or download this paste. . Pasted through web.

global_registry = {}
def my_deco(arg):
def inner_deco(f):
global_registry[f] = {'arg': arg, 'signature': inspect.signature(f)}
return f
return inner_deco
@my_deco(arg="blah")
def foo(a: int, b: str):
print(a, b)
@my_deco(arg="whatever")
def stuff(a: str, b: float):
print(a, b)
print(global_registry)
Filename: deco.py. Size: 327b. View raw, , hex, or download this file.
{<function foo at 0x7fac9199a3a0>: {'arg': 'blah', 'signature': <Signature (a: int, b: str)>}, <function stuff at 0x7fac9199a310>: {'arg': 'whatever', 'signature': <Signature (a: str, b: float)>}}
Filename: output.txt. Size: 196b. View raw, , hex, or download this file.