def toListInt ( value ) : if TypeConverters . _can_convert_to_list ( value ) : value = TypeConverters . toList ( value ) if all ( map ( lambda v : TypeConverters . _is_integer ( v ) , value ) ) : return [ int ( v ) for v in value ] raise TypeError ( "Could not convert %s to list of ints" % value )
python try cast int list
Convert a value to list of ints if possible .
def toListInt(value):
        """
        Convert a value to list of ints, if possible.
        """
        if TypeConverters._can_convert_to_list(value):
            value = TypeConverters.toList(value)
            if all(map(lambda v: TypeConverters._is_integer(v), value)):
                return [int(v) for v in value]
        raise TypeError("Could not convert %s to list of ints" % value)