'add the given column to this collection, removing unaliased
versions of this column  as well as existing columns with the
same key.
e.g.::
t = Table(\'sometable\', metadata, Column(\'col1\', Integer))
t.columns.replace(Column(\'col1\', Integer, key=\'columnone\'))
will remove the original \'col1\' from the collection, and add
the new column under the name \'columnname\'.
Used by schema.Column to override columns during table reflection.'

def replace(self, column):

    remove_col = None
    if ((column.name in self) and (column.key != column.name)):
        other = self[column.name]
        if (other.name == other.key):
            remove_col = other
            self._all_col_set.remove(other)
            del self._data[other.key]
    if (column.key in self._data):
        remove_col = self._data[column.key]
        self._all_col_set.remove(remove_col)
    self._all_col_set.add(column)
    self._data[column.key] = column
    if (remove_col is not None):
        self._all_columns[:] = [(column if (c is remove_col) else c) for c in self._all_columns]
    else:
        self._all_columns.append(column)
