Does something like this exist def getval(self, key) try: return self.__keys[key] except KeyError: self.__keys[key] = None retry #!!!! thanks, Dan