def __getattr__(self, key):
        assert key != '_hash', \
            '%s expressions should set _hash in __init__' % type(self).__name__
        try:
            result = object.__getattribute__(self, key)
        except __HOLE__:
            fields = dict(zip(map(valid_identifier, self.fields), self.fields))

            # prefer the method if there's a field with the same name
            methods = toolz.merge(
                schema_methods(self.dshape.measure),
                dshape_methods(self.dshape)
            )
            if key in methods:
                func = methods[key]
                if func in method_properties:
                    result = func(self)
                else:
                    result = boundmethod(func, self)
            elif self.fields and key in fields:
                if isscalar(self.dshape.measure):  # t.foo.foo is t.foo
                    result = self
                else:
                    result = self[fields[key]]
            else:
                raise

        # cache the attribute lookup, getattr will not be invoked again.
        setattr(self, key, result)
        return result
dataset/ETHPy150Open blaze/blaze/blaze/expr/expressions.py/Expr.__getattr__