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 1
1
Usage
2
2
=====
3
3
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
+ ----------------------------------------------
5
6
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.
11
8
9
+ In this example, the validation function is returned by the ``shape `` closure which stores
10
+ the tuple in its closure.
12
11
13
12
.. code ::
14
13
@@ -28,4 +27,3 @@ The ``Array`` trait type provide an implementation of a trait type for the numpy
28
27
foo = Foo()
29
28
30
29
foo.bar = [1, 2] # Should raise a TraitError
31
-
You can’t perform that action at this time.
0 commit comments