[python-graph] r749 committed - Using isinstance instead of type() when deciding strategy in find_cycl...

0 views
Skip to first unread message

python...@googlecode.com

unread,
Feb 19, 2012, 2:45:52 PM2/19/12
to python...@googlegroups.com
Revision: 749
Author: pmatiello
Date: Sun Feb 19 11:45:29 2012
Log: Using isinstance instead of type() when deciding strategy in
find_cycle()
http://code.google.com/p/python-graph/source/detail?r=749

Modified:
/trunk/core/pygraph/algorithms/cycles.py

=======================================
--- /trunk/core/pygraph/algorithms/cycles.py Thu Jun 17 17:14:28 2010
+++ /trunk/core/pygraph/algorithms/cycles.py Sun Feb 19 11:45:29 2012
@@ -49,9 +49,9 @@
@return: List of nodes.
"""

- if (type(graph) == graph_class):
+ if (isinstance(graph, graph_class)):
directed = False
- elif (type(graph) == digraph_class):
+ elif (isinstance(graph, digraph_class)):
directed = True
else:
raise InvalidGraphType

Reply all
Reply to author
Forward
0 new messages