Advertisement
whoeverest

Runtime bind with types.MethodType

Jul 4th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. from cv2.cv import iplimage
  2. from types import *
  3.  
  4. im = LoadImage("path/to/image.png")
  5.  
  6. def width(self):
  7.     return self.width
  8.  
  9. bound_width = MethodType(len, im, iplimage)
  10.  
  11. print bound_width() # returns im.width
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement