Skip to content

Commit 9494e14

Browse files
committed
Improve Usage Example
1 parent 4c8aed8 commit 9494e14

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

docs/source/usage.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
Usage
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-

0 commit comments

Comments
 (0)