Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MapDict(object):
- '''A simple object-generator. Like a named-tuple.'''
- def __init__(self, map, *args):
- self.map = map
- for index in range(self.map):
- setattr(self, key[index], args[index])
- def __str__(self):
- return '\n'.join(['%s = "%s"' % (key, getattr(self, key))
- for key in self.map])
- class MapObject(object):
- '''Given a list and an object, copy those attributes to self'''
- def __init__(self, obj):
- self.map = obj.map
- for key in self.map:
- setattr(self, key, getattr(obj, key))
- def __str__(self):
- return '\n'.join(['%s = "%s"' % (key, getattr(self, key))
- for key in self.map])
Add Comment
Please, Sign In to add comment