Skip to content

Instantly share code, notes, and snippets.

@KitWallace
Created August 30, 2012 08:50
Show Gist options
  • Save KitWallace/3524396 to your computer and use it in GitHub Desktop.
Save KitWallace/3524396 to your computer and use it in GitHub Desktop.
a superclass for simple persistance
import pickle
import time
def get(name) :
file = open("obj/"+name+".pkl","r")
return pickle.load(file)
class Persistant(object) :
def __init__(self,name) :
self.name = name
self.ts = time.time()
def put(self) :
file = open("obj/"+self.name+".pkl","w")
self.ts = time.time()
pickle.dump(self,file,0)
return self
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment