class Classtionary(dict):
"""A Class, er, dictionary, um, attributes-as-keys thingy.
>>> c = Classtionary(foo="bar")
>>> d = dict(foo="bar")
>>> c, d
({'foo': 'bar'}, {'foo': 'bar'})
>>> c.fizz = "bang"
>>> d.fizz = "bang"
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'dict' object has no attribute 'fizz'
>>> d['fizz'] = "bang"
>>> c['fizz']
'bang'
>>> c.fizz
'bang'
>>> d['fizz']
'bang'
>>> d.fizz
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'dict' object has no attribute 'fizz'
"""
def __init__(self, **kwargs):
self.__dict__ = self
self.update(kwargs)