'Get a parser for the given directory, or create one if
necessary.  This way parsers can be cached and reused.
# @@: settings are inherited from the first caller'

def get_parser(self, directory, base_python_name):

    try:
        return self.parsers_by_directory[(directory, base_python_name)]
    except KeyError:
        parser = self.__class__({}, directory, base_python_name, index_names=self.index_names, hide_extensions=self.hide_extensions, ignore_extensions=self.ignore_extensions, constructors=self.constructors)
        self.parsers_by_directory[(directory, base_python_name)] = parser
        return parser
