Is x hashable? Examples -------- >>> ishashable(1) True >>> ishashable([1]) False See Also -------- iskey
(x)
| 16 | |
| 17 | |
| 18 | def ishashable(x): |
| 19 | """Is x hashable? |
| 20 | |
| 21 | Examples |
| 22 | -------- |
| 23 | |
| 24 | >>> ishashable(1) |
| 25 | True |
| 26 | >>> ishashable([1]) |
| 27 | False |
| 28 | |
| 29 | See Also |
| 30 | -------- |
| 31 | iskey |
| 32 | """ |
| 33 | try: |
| 34 | hash(x) |
| 35 | return True |
| 36 | except TypeError: |
| 37 | return False |
| 38 | |
| 39 | |
| 40 | def istask(x): |
no outgoing calls
searching dependent graphs…