Created
June 13, 2013 20:01
-
-
Save Sunno/5776859 to your computer and use it in GitHub Desktop.
A child class from dict in python that add some extra features to dict, in this case conversion to json
just create an instance and you have dict features together with new features.
This file contains 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
''' | |
Created on 13/06/2013 | |
@author: Alvaro Marquina | |
''' | |
import json | |
class dict2(dict): | |
''' | |
adds some functions to dict | |
''' | |
def to_json(self): | |
return json.dumps(self) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment