Skip to content

Commit

Permalink
Merge pull request #1294 from vsmutok/update-checklist
Browse files Browse the repository at this point in the history
  • Loading branch information
sergii-nosachenko authored Oct 25, 2024
2 parents f74e6d1 + 07d6f59 commit 3d01a9e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions checklist.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Сheck Your Code Against the Following Points

## Make Code Easier

1. Don't use an extra `else` statement.
Expand All @@ -20,8 +21,22 @@ else:
return "Is not hungry!"
```

2. Use a `@staticmethod` for some functions.
3. Don't use a `for` loop if you can use a list comprehension.
2. Don't use a `for` loop if you can use generator expression.

Good example:

```python
return sum(item.process() for item in collection)
```

Bad example:

```python
total = 0
for item in collection:
total += item.process()
return total
```

## Code Style

Expand Down

0 comments on commit 3d01a9e

Please sign in to comment.