Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 0f12b69182fe3d3174a2e2454ef87704 > files > 537

python-sqlalchemy-0.6.8-1.fc14.x86_64.rpm

"""Illustrates a clever technique using Python descriptors to create custom attributes representing SQL expressions when used at the class level, and Python expressions when used at the instance level.   In some cases this technique replaces the need to configure the attribute in the mapping, instead relying upon ordinary Python behavior to create custom expression components.

E.g.::

    class BaseInterval(object):
        @hybrid
        def contains(self,point):
            return (self.start <= point) & (point < self.end)

"""