class relation: def __init__(self, *fields): self._fields = tuple(fields) self._degree = len(self._fields) def fields(self): return self._fields def degree(self): return self._degree class namemap: def __init__(self, *pairs): self._map = {} self._rmap = {} for key,val in pairs: self._map[key]=val self._rmap[val]=key def map(self, i): return self._map[i] def rmap(self, i): return self._rmap[i] nm = namemap(('A','a'), ('B','b')) print nm._map print nm._rmap rel = relation('a', 'b', 'c') print rel.fields() print rel.degree()