(self)
return ColumnCollection(
            (name_for_col(c), c) for c in cols
        ).as_immutable()
A :class:`.ColumnCollection` representing the columns that
        this SELECT statement or similar construct returns in its result set.

        This collection differs from the :attr:`.FromClause.columns` collection
        of a :class:`.FromClause` in that the columns within this collection
        cannot be directly nested inside another SELECT statement; a subquery
        must be applied first which provides for the necessary parenthesization
        required by SQL.

        For a :func:`.select` construct, the collection here is exactly what
        would be rendered inside the  "SELECT" statement, and the
        :class:`.ColumnElement` objects are  directly present as they were
        given, e.g.::

            col1 = column('q', Integer)
            col2 = column('p', Integer)
            stmt = select([col1, col2])

        Above, ``stmt.selected_columns`` would be a collection that contains
        the ``col1`` and ``col2`` objects directly.    For a statement that is
        against a :class:`.Table` or other :class:`.FromClause`, the collection
        will use the :class:`.ColumnElement` objects that are in the
        :attr:`.FromClause.c` collection of the from element.

        .. versionadded:: 1.4
A :class:`.ColumnCollection` representing the columns that
        this SELECT statement or similar construct returns in its result set.
A : class : . ColumnCollection representing the columns that this SELECT statement or similar construct returns in its result set .
def selected_columns(self):
        """A :class:`.ColumnCollection` representing the columns that
        this SELECT statement or similar construct returns in its result set.

        This collection differs from the :attr:`.FromClause.columns` collection
        of a :class:`.FromClause` in that the columns within this collection
        cannot be directly nested inside another SELECT statement; a subquery
        must be applied first which provides for the necessary parenthesization
        required by SQL.

        For a :func:`.select` construct, the collection here is exactly what
        would be rendered inside the  "SELECT" statement, and the
        :class:`.ColumnElement` objects are  directly present as they were
        given, e.g.::

            col1 = column('q', Integer)
            col2 = column('p', Integer)
            stmt = select([col1, col2])

        Above, ``stmt.selected_columns`` would be a collection that contains
        the ``col1`` and ``col2`` objects directly.    For a statement that is
        against a :class:`.Table` or other :class:`.FromClause`, the collection
        will use the :class:`.ColumnElement` objects that are in the
        :attr:`.FromClause.c` collection of the from element.

        .. versionadded:: 1.4

        """
        names = set()

        cols = _select_iterables(self._raw_columns)

        def name_for_col(c):
            # we use key_label since this name is intended for targeting
            # within the ColumnCollection only, it's not related to SQL
            # rendering which always uses column name for SQL label names
            if self.use_labels:
                name = c._key_label
            else:
                name = c._proxy_key
            if name in names:
                if self.use_labels:
                    name = c._label_anon_label
                else:
                    name = c.anon_label
            else:
                names.add(name)
            return name

        return ColumnCollection(
            (name_for_col(c), c) for c in cols
        ).as_immutable()
def selected_columns ( self ) : names = set ( ) cols = _select_iterables ( self . _raw_columns ) def name_for_col ( c ) : # we use key_label since this name is intended for targeting # within the ColumnCollection only, it's not related to SQL # rendering which always uses column name for SQL label names if self . use_labels : name = c . _key_label else : name = c . _proxy_key if name in names : if self . use_labels : name = c . _label_anon_label else : name = c . anon_label else : names . add ( name ) return name return ColumnCollection ( ( name_for_col ( c ) , c ) for c in cols ) . as_immutable ( )