def f1(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15): def g1(): return (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15) return g1 def f2(x15,x14,x13,x12,x11,x10,x9,x8,x7,x6,x5,x4,x3,x2,x1): def g2(): return (x15,x14,x13,x12,x11,x10,x9,x8,x7,x6,x5,x4,x3,x2,x1) return g2 #print(f1(*range(15)).__code__.co_freevars) #print(f2(*range(15)).__code__.co_freevars) #print('') g1 = f1(*range(15)) g1.__code__ = f2(*range(15)).__code__ print(g1())