Created
          August 30, 2012 08:50 
        
      - 
      
- 
        Save KitWallace/3524396 to your computer and use it in GitHub Desktop. 
    a superclass for simple persistance 
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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