aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2016-10-03 21:14:08 +0200
committerTollef Fog Heen <tfheen@err.no>2016-10-03 21:14:08 +0200
commit87bb133838b4862f985277775f55c9a4b48e92ba (patch)
treeddc4db9a8edaece67a06c67b9fd2eba5b29b9d6a /wee_slack.py
parent0f1613d5eac212e07b2751e7a999656afc642443 (diff)
downloadwee-slack-87bb133838b4862f985277775f55c9a4b48e92ba.tar.gz
Speed up User comparison
Avoid creating a full new string and use a string slice instead.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index b2804b7..8a2276f 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -880,7 +880,9 @@ class User(object):
def __eq__(self, compare_str):
try:
- if compare_str == self.name or compare_str == "@" + self.name or compare_str == self.identifier:
+ if compare_str == self.name or compare_str == self.identifier:
+ return True
+ elif compare_str[0] == '@' and compare_str[1:] == self.name:
return True
else:
return False