Advertisement
miki725

Untitled

Jan 24th, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def to_python(self, data):
  2.     # no logic, pass the logic to the wrapper
  3.     if isinstance(data, MyHexWrapper):
  4.         return data
  5.     else:
  6.         return MyHexWrapper(data)
  7.  
  8. class MyHexWrapper(object):
  9.     def __init__(self, data=None):
  10.         # deal with all different options here
  11.         t_data = type(data)
  12.         if t_data is foo:
  13.             pass
  14.         elif t_data is bar:
  15.             pass
  16.         ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement