3 ms·
def _check_networkx_graph(self, graph): try: if not isinstance(graph, nx.classes.graph.Graph): raise TypeError("This is not
by perfunctory 6y 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.
- nerdponx 6y agoYikes. 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?