Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('my.pickle', 'ab')
- class ID(object):
- def __init__(self, entity):
- self.entity_class = entity.__class__
- self.entity = entity
- objects[ID].append(self)
- if self.entity_class not in objects.keys():
- objects[self.entity_class] = []
- objects[self.entity_class].append(self.entity)
- else:
- objects[self.entity_class].append(self.entity)
- objects = {ID:[]}
- class Entity():
- fields_preset = []
- relations_preset = []
- def __init__(self):
- self.entity_id = ID(self)
- self.fields = []
- self.relations = []
- t =type("NewType", (Entity,), {"x": "hello"})
- t()
- pickle.dump(objects, f, 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement