Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. result = [obj.f() for f in [append, attrs]]
  2.  
  3. result = [f() for f in [obj.append, obj.attrs]]
  4.  
  5. result = [getattr(obj, m)() for m in ["append", "attrs"]]
  6.  
  7. methods = [methodcaller(m) for m in ["append", "attrs"]]
  8. results_for_obj_a = [f(obj_a) for f in methods]
  9. results_for_obj_b = [f(obj_b) for f in methods]
  10. # etc.
  11.  
  12. methodcaller(method_name)(obj) == getattr(obj, method_name)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement