(obj)
return hasattr(obj, '__getitem__')
Tests if an object is a collection. Strings don't count.
Tests if an object is a collection. Strings don't count.
Tests if an object is a collection . Strings don t count .
def is_collection(obj):
    """Tests if an object is a collection. Strings don't count."""

    if isinstance(obj, basestring):
        return False

    return hasattr(obj, '__getitem__')
def is_collection ( obj ) : if isinstance ( obj , basestring ) : return False return hasattr ( obj , '__getitem__' )