Skip to content

Instantly share code, notes, and snippets.

@thomasballinger
Created September 19, 2014 15:08
Show Gist options
  • Save thomasballinger/18095c22fa067147dd52 to your computer and use it in GitHub Desktop.
Save thomasballinger/18095c22fa067147dd52 to your computer and use it in GitHub Desktop.
### current bpython session - file will be reevaluated, ### lines will not be run
class Mapping(object):
def __init__(self):
self.dict = {}
def add_key_value_pair(self, key, value):
self.dict[key] = value
def get_value(self, key):
return self.dict[key]
def remove_key(self, key):
del self.dict[key]
m = Mapping()
m.add_key_value_pair('hello', 10)
m.get_value('hello')
### 10
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment