'Leaves of an expression tree
All nodes without inputs.  Leaves are returned in order, left to right.
>>> from blaze.expr import symbol, join, by
>>> t = symbol(\'t\', \'var * {id: int32, name: string}\')
>>> t._leaves()
[<`t` symbol; dshape=\'var * {id: int32, name: string}\'>]
>>> by(t.name, count=t.id.nunique())._leaves()
[<`t` symbol; dshape=\'var * {id: int32, name: string}\'>]
>>> v = symbol(\'v\', \'var * {id: int32, city: string}\')
>>> join(t, v)._leaves() == [t, v]
True'

def _leaves(self):

    if (not self._inputs):
        return [self]
    else:
        return list(unique(concat((i._leaves() for i in self._inputs if isinstance(i, Node)))))
