Hacker News new | ask | show | jobs
by perfunctory 2221 days ago

      def _check_networkx_graph(self, graph):
        try:
            if not isinstance(graph, nx.classes.graph.Graph):
                raise TypeError("This is not a NetworkX graph. Please see requirements.")
        except:
                exit("This is not a NetworkX graph. Please see requirements.")
First, I don't want any library to call exit on me. Second, what is it even trying to do? Raising an exception and immediately catching it? At best this is just a horrible style.
1 comments

Yikes. Is this meant to be used in a command line application? Or are you actually meant to call a function in your code that could crash your application on bad input?