Skip to content

Commit 3c2e183

Browse files
committed
Change all operations to lazy evaluation
1 parent 1149998 commit 3c2e183

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/player.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def update_traits(self, traits):
4242

4343
def has_traits(self, traits):
4444
"""Return true if the player has all traits in parameter traits (equal or more)"""
45-
return all([
45+
return all(
4646
self.traits.get(trait, 0) > value
47-
for trait, value in traits.items()])
47+
for trait, value in traits.items())
4848

4949

5050
def update_items(self, items: dict):
@@ -55,9 +55,9 @@ def update_items(self, items: dict):
5555

5656
def has_items(self, items: dict):
5757
"""Return true if the player has at least number of items specified in parameter items"""
58-
return all([
58+
return all(
5959
self.items.get(item, 0) > count
60-
for item, count in items.items()])
60+
for item, count in items.items())
6161

6262

6363
def set_history(self, history: dict):
@@ -68,9 +68,9 @@ def set_history(self, history: dict):
6868

6969
def has_history(self, history: dict):
7070
"""Return true if all values in player history and in parameter are equal"""
71-
return all([
71+
return all(
7272
self.history.get(story, False) == value
73-
for story, value in history.items()])
73+
for story, value in history.items())
7474

7575

7676
def load_player_from(content):

0 commit comments

Comments
 (0)