def isList(l):
 return (hasattr(l, '__iter__') or (type(l) in (types.ListType, types.TupleType)))

def isList ( l ) : return ( hasattr ( l , '__iter__' ) or ( type ( l ) in ( types . ListType , types . TupleType ) ) )
convenience method that works with all 2 .