def choose_columns(nb_columns, column_names=None, names=None, indexes=None):
    """Selects a list of columns from a table.

    If both the names and indexes lists are specified, the function will make
    sure that they represent the same list of columns.
    Columns may appear more than once.
    """
    if names is not None:
        if column_names is None:
            raise ValueError("Unable to get column by names: table "
                             "doesn't have column names")
        result = []
        for name in names:
            if isinstance(name, unicode):
                name = name.encode('utf-8')
            try:
                idx = column_names.index(name)
            except ValueError:
                try:
                    idx = column_names.index(name.strip())
                except ValueError:
                    raise ValueError("Column name was not found: %r" % name)
            result.append(idx)
        if indexes is not None:
            if result != indexes:
                raise ValueError("Both column names and indexes were "
                                 "specified, and they don't agree")
        return result
    elif indexes is not None:
        for index in indexes:
            if index < 0 or nb_columns >= index:
                raise ValueError("No column %d, table only has %d columns" % (
                                 index, nb_columns))
        return indexes
    else:
        raise ValueError("No column names nor indexes specified")
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/packages/tabledata/common.py/choose_columns/swapped operands of `>=`