Skip to content
This repository has been archived by the owner on Jan 13, 2018. It is now read-only.

Commit

Permalink
Add: __repr__ method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Salisbury committed Aug 18, 2010
1 parent 48cc05c commit de4eb6a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions simpledb.py
Expand Up @@ -47,6 +47,13 @@ def __setitem__(self, key, value):
value = dumps(value)
self.data[key] = value

def __repr__(self):
""" Represent the database. """

keys = self.data.keys()
items = [(loads(key), loads(self.data[key])) for key in keys]
return str(dict(items))

def clear(self):
""" Remove all data in the database. """

Expand Down

0 comments on commit de4eb6a

Please sign in to comment.