DOC: add comments about the column collection in DataSetMeta

This commit is contained in:
Joe Jevnik
2015-12-29 10:13:00 -05:00
parent 68cf236944
commit 54c58d1205
+2
View File
@@ -115,11 +115,13 @@ class DataSetMeta(type):
def __new__(mcls, name, bases, dict_):
newtype = super(DataSetMeta, mcls).__new__(mcls, name, bases, dict_)
# collect all of the column names that we inherit from our parents
column_names = set().union(
*(getattr(base, '_column_names', ()) for base in bases)
)
for maybe_colname, maybe_column in iteritems(dict_):
if isinstance(maybe_column, Column):
# add column names defined on our class
bound_column_descr = maybe_column.bind(maybe_colname)
setattr(newtype, maybe_colname, bound_column_descr)
column_names.add(maybe_colname)