Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. def get_foo():
  2. def f(self, i):
  3. print(self,i)
  4. return f
  5.  
  6. class A(object):
  7.  
  8. def __init__(self, x):
  9. self.x = x
  10.  
  11. def __str__(self):
  12. return str(self.x)
  13.  
  14. def __repr__(self):
  15. return str(self.x)
  16.  
  17. foo = get_foo();
  18.  
  19.  
  20. a = A(5)
  21. a.foo(4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement