Re: [matplotlib-devel] matplotlib.cbook.iterable

2011-03-23 Thread Ludwig Schwardt
Hi, In my code I have yet another version: def is_iterable(x): """Checks if object is iterable (but not a string).""" return hasattr(x, '__iter__') I specifically wanted to test for lists, tuples and numpy arrays, but not strings. Depending on the semantics of underscored methods could b

Re: [matplotlib-devel] matplotlib.cbook.iterable

2011-03-23 Thread Michael Droettboom
I think this first one is sufficient and should work correctly for more things than the second. I'll go ahead and add this to matplotlib master -- I'm a little wary of changing this in 1.0.x in case someone is relying on the currently broken behavior. Mike try: iter(obj) except TypeError: ret