Skip to content

Commit

Permalink
SIM105: Add notice about speed impact in README
Browse files Browse the repository at this point in the history
Closes #91
  • Loading branch information
MartinThoma committed Feb 9, 2022
1 parent 31ce0a3 commit 092a3a9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,25 @@ if a and b:
c
```

### SIM105

```python
# Bad
try:
foo()
except ValueError:
pass

# Good
from contextlib import suppress

with suppress(ValueError):
foo()
```

Please note that `contextlib.suppress` is roughly 3x slower than `try/except`
([source](https://github.com/MartinThoma/flake8-simplify/issues/91)).

### SIM107

```python
Expand Down

0 comments on commit 092a3a9

Please sign in to comment.