From e4f233ecfedd2aafa258db2d3ae27e30604cc020 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Mon, 28 Dec 2009 20:49:52 +0000 Subject: fixed a whole bunch of doctests --- numpy/doc/misc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'numpy/doc/misc.py') diff --git a/numpy/doc/misc.py b/numpy/doc/misc.py index eb2dc4395..8575a8e4f 100644 --- a/numpy/doc/misc.py +++ b/numpy/doc/misc.py @@ -13,12 +13,12 @@ original value was) Note: cannot use equality to test NaNs. E.g.: :: + >>> myarr = np.array([1., 0., np.nan, 3.]) >>> np.where(myarr == np.nan) >>> nan == nan # is always False! Use special numpy functions instead. >>> np.nan == np.nan False - >>> myarr = np.array([1., 0., np.nan, 3.]) >>> myarr[myarr == np.nan] = 0. # doesn't work >>> myarr array([ 1., 0., NaN, 3.]) @@ -68,7 +68,7 @@ These behaviors can be set for all kinds of errors or specific ones: :: underflow: floating point underflows Note that integer divide-by-zero is handled by the same machinery. -These behaviors are set on a per-thead basis. +These behaviors are set on a per-thread basis. Examples: ------------ @@ -86,6 +86,7 @@ Examples: >>> def errorhandler(errstr, errflag): ... print "saw stupid error!" >>> np.seterrcall(errorhandler) + >>> j = np.seterr(all='call') >>> np.zeros(5, dtype=np.int32)/0 FloatingPointError: invalid value encountered in divide -- cgit v1.2.1