Skip to content

Commit 0386d56

Browse files
committed
Merge pull request glamp#22 from mloccy/master
Created isiterable in utils/helpers.py to check if an object is iterable...
2 parents 02baad0 + c2cdc8a commit 0386d56

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

bashplotlib/histogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def read_numbers(numbers):
3535
"""
3636
Read the input data in the most optimal way
3737
"""
38-
if isinstance(numbers, list):
38+
if isiterable(numbers):
3939
for number in numbers:
4040
yield float(str(number).strip())
4141
else:

bashplotlib/utils/helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import sys
99

10+
isiterable = lambda x: hasattr(x, '__iter__') or hasattr(x, '__getitem__')
11+
1012
bcolours = {
1113
"white": '\033[97m',
1214
"aqua": '\033[96m',

0 commit comments

Comments
 (0)