mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-10 11:50:32 +08:00
DOC: Explain why _BoundColumnDescr exists.
We don't want to bind to parent DataSets when we bind to names because we want to dynamically create new BoundColumns in subclasses.
This commit is contained in:
@@ -33,12 +33,21 @@ class _BoundColumnDescr(object):
|
||||
"""
|
||||
Intermediate class that sits on `DataSet` objects and returns memoized
|
||||
`BoundColumn` objects when requested.
|
||||
|
||||
This exists so that subclasses of DataSets don't share columns with their
|
||||
parent classes.
|
||||
"""
|
||||
def __init__(self, dtype, name):
|
||||
self.dtype = dtype
|
||||
self.name = name
|
||||
|
||||
def __get__(self, instance, owner):
|
||||
"""
|
||||
Produce a concrete BoundColumn object when accessed.
|
||||
|
||||
We don't bind to datasets at class creation time so that subclasses of
|
||||
DataSets produce different BoundColumns.
|
||||
"""
|
||||
return BoundColumn(
|
||||
dtype=self.dtype,
|
||||
dataset=owner,
|
||||
|
||||
Reference in New Issue
Block a user