diff --git a/sknn/dataset.py b/sknn/dataset.py index 6b171dd..84c8980 100644 --- a/sknn/dataset.py +++ b/sknn/dataset.py @@ -19,14 +19,26 @@ class FastVectorSpace(VectorSpace): @functools.wraps(VectorSpace._validate) def _validate(self, is_numeric, batch): + """ + Short-circuit the entire validation if the user has specified it's not necessary. + """ pass def __eq__(self, other): + """ + Equality should work between Fast and slow VectorSpace instances. + """ return (type(other) in (FastVectorSpace, VectorSpace) and self.dim == other.dim and self.sparse == other.sparse and self.dtype == other.dtype) + def __hash__(self): + """ + Override necessary for Python 3.x. + """ + return hash((type(VectorSpace), self.dim, self.sparse, self.dtype)) + class SparseDesignMatrix(Dataset): """