annotate wsgraph/utils.py @ 54:a10582739c9c

http://igraph.sourceforge.net/
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 25 Jun 2013 10:25:36 -0700
parents f1f7a505e0d0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 """
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 utility functions that should be in core python
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 def isiterable(instance):
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 try:
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 iter(instance)
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 return True
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 except TypeError:
f1f7a505e0d0 __contains__ method
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 return False