annotate wsgraph/utils.py @ 41:194ea1428156

from http://k0s.org/portfolio/directed-graph.txt
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 11 Apr 2013 15:31:38 -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