File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 11Usage
22=====
33
4- The ``Array `` trait type provide an implementation of a trait type for the numpy array.
4+ Example: Validating the Shape of a Numpy Array
5+ ----------------------------------------------
56
6- ``Array `` overrides certain public methods from ``TraitType `` that are generally not
7- overloaded by custom trait types, in order to work around some limitations with
8- numpy array comparison.
9-
10- ``Array `` provides an API for adding custom validators to constained proposed values for the attribute.
7+ We pass a validation function to the ``valid `` method of the ``Array `` trait type.
118
9+ In this example, the validation function is returned by the ``shape `` closure which stores
10+ the tuple in its closure.
1211
1312.. code ::
1413
@@ -28,4 +27,3 @@ The ``Array`` trait type provide an implementation of a trait type for the numpy
2827 foo = Foo()
2928
3029 foo.bar = [1, 2] # Should raise a TraitError
31-
You can’t perform that action at this time.
0 commit comments