FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Implement iterable in terms of iteration, not length (reported by Jas… · matplotlib/matplotlib@2a0c65e · GitHub

Repository navigation

Commit 2a0c65e

Browse files
Implement iterable in terms of iteration, not length (reported by Jason Grout)
1 parent 70683d4 commit 2a0c65e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎lib/matplotlib/cbook.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,10 @@ def unique(x):
374374

375375
def iterable(obj):
376376
'return true if *obj* is iterable'
377-
try: len(obj)
378-
except: return False
377+
try:
378+
iter(obj)
379+
except TypeError:
380+
return False
379381
return True
380382

381383

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL