Skip to content

Commit baed24d

Browse files
committed
DRY up the subscribe conditional a bit
1 parent 1799a8f commit baed24d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

publish_subscribe.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ def notify(self, msg):
1919
def subscribe(self, msg, subscriber):
2020
if msg not in self.subscribers:
2121
self.subscribers[msg] = []
22-
self.subscribers[msg].append(subscriber) # unfair
23-
else:
24-
self.subscribers[msg].append(subscriber)
22+
23+
self.subscribers[msg].append(subscriber)
2524

2625
def unsubscribe(self, msg, subscriber):
2726
self.subscribers[msg].remove(subscriber)

0 commit comments

Comments
 (0)