def __new__(meta, name, bases, attrs):
        """Create the class as normal, but also iterate over the attributes
        set and gather up any that are Cols, and store them, so they
        can be iterated over later.

        """
        cls = type.__new__(meta, name, bases, attrs)
        cls._cols = OrderedDict()
        # If there are any base classes with a `_cols` attribute, add
        # them to the columns for this table.
        for parent in bases:
            try:
                parent_cols = parent._cols
            except AttributeError:
                continue
            else:
                cls._cols.update(parent_cols)
        # Then add the columns from this class.
        this_cls_cols = sorted(
            ((k, v) for k, v in attrs.items() if isinstance(v, Col)),
            key=lambda x: x[1]._counter_val)
        cls._cols.update(OrderedDict(this_cls_cols))
        return cls
def __new__ ( meta , name , bases , attrs ) : cls = type . __new__ ( meta , name , bases , attrs ) cls . _cols = OrderedDict ( ) for parent in bases : try : parent_cols = parent . _cols except AttributeError : continue else : cls . _cols . update ( parent_cols ) this_cls_cols = sorted ( ( ( k , v ) for k , v in attrs . items ( ) if isinstance ( v , Col ) ) , key = lambda x : x [ 1 ] . _counter_val ) cls . _cols . update ( OrderedDict ( this_cls_cols ) ) return cls
Create the class as normal, but also iterate over the attributes
        set and gather up any that are Cols, and store them, so they
        can be iterated over later.