annotate wsgraph/utils.py @ 48:0485b2293988

ganv
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 30 Apr 2013 19:35:21 -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