We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5985b7b commit a47b18bCopy full SHA for a47b18b
lib/matplotlib/cbook.py
@@ -202,21 +202,25 @@ def unique(x):
202
return dict([ (val, 1) for val in x]).keys()
203
204
def iterable(obj):
205
+ 'return true if obj is iterable'
206
try: len(obj)
207
except: return 0
208
return 1
209
210
211
def is_string_like(obj):
212
+ 'return true if obj looks like a string'
213
if hasattr(obj, 'shape'): return 0
214
try: obj + ''
215
except (TypeError, ValueError): return 0
216
217
218
def is_writable_file_like(obj):
219
+ 'return true if obj looks like a file object'
220
return hasattr(obj, 'write') and callable(obj.write)
221
222
def is_scalar(obj):
223
+ 'return true if ob is not string like and is not iterable'
224
return is_string_like(obj) or not iterable(obj)
225
226
def is_numlike(obj):
0 commit comments