mention np.errstate
context manager in exercise 31.
This commit is contained in:
parent
e8ad2e1123
commit
4cb1d8cd76
@ -282,12 +282,19 @@ print(np.intersect1d(Z1,Z2))
|
||||
```python
|
||||
# Suicide mode on
|
||||
defaults = np.seterr(all="ignore")
|
||||
Z = np.ones(1)/0
|
||||
Z = np.ones(1) / 0
|
||||
|
||||
# Back to sanity
|
||||
_ = np.seterr(**defaults)
|
||||
```
|
||||
|
||||
An equivalent way, with a context manager:
|
||||
|
||||
```python
|
||||
with np.errstate(divide='ignore'):
|
||||
Z = np.ones(1) / 0
|
||||
```
|
||||
|
||||
#### 32. Is the following expressions true? (★☆☆)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user