def col_copy(col, copy_indices=True):
 if isinstance(col, BaseColumn):
  return col.copy()
 parent_table = col.info.parent_table
 indices = col.info.indices
 col.info.parent_table = None
 col.info.indices = []
 try:
  newcol = (col.copy() if hasattr(col, u'copy') else deepcopy(col))
  newcol.info = col.info
  newcol.info.indices = (deepcopy((indices or [])) if copy_indices else [])
  for index in newcol.info.indices:
   index.replace_col(col, newcol)
 finally:
  col.info.parent_table = parent_table
  col.info.indices = indices
 return newcol

def col_copy ( col , copy_indices = True ) : if isinstance ( col , BaseColumn ) : return col . copy ( ) parent_table = col . info . parent_table indices = col . info . indices col . info . parent_table = None col . info . indices = [ ] try : newcol = ( col . copy ( ) if hasattr ( col , u'copy' ) else deepcopy ( col ) ) newcol . info = col . info newcol . info . indices = ( deepcopy ( ( indices or [ ] ) ) if copy_indices else [ ] ) for index in newcol . info . indices : index . replace_col ( col , newcol ) finally : col . info . parent_table = parent_table col . info . indices = indices return newcol
this is a mixin-safe version of column .