Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def to_python(self, data):
- # no logic, pass the logic to the wrapper
- if isinstance(data, MyHexWrapper):
- return data
- else:
- return MyHexWrapper(data)
- class MyHexWrapper(object):
- def __init__(self, data=None):
- # deal with all different options here
- t_data = type(data)
- if t_data is foo:
- pass
- elif t_data is bar:
- pass
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement