fork download
  1. def f1(*,n=[0]): #Костыль с изменяемыми переменными
  2. n[0]+=1 #В коде вместо переменной хрень с индексом
  3. return n[0]
  4.  
  5. print(f1(),f1())
  6.  
  7.  
  8.  
  9. def class_to_fun(x): return x()
  10.  
  11. @class_to_fun
  12. class f2: #Превратить функцию в говно и писать как будто так и задумано
  13. n=0
  14. def __call__(self):
  15. f2.n+=1 #В коде вместо переменной хрень с точкой
  16. return f2.n
  17.  
  18. print(f2(),f2())
  19.  
  20.  
  21.  
  22. def create(n,x):
  23. globals().setdefault(n,x)
  24.  
  25. def f3():
  26. global x
  27. create("x",0)
  28. x+=1
  29. return x
  30.  
  31. print(f3(),f3())
Success #stdin #stdout 0.02s 9264KB
stdin
Standard input is empty
stdout
1 2
1 2
1 2