diff options
author | Tollef Fog Heen <tfheen@err.no> | 2016-10-03 21:14:08 +0200 |
---|---|---|
committer | Tollef Fog Heen <tfheen@err.no> | 2016-10-03 21:14:08 +0200 |
commit | 87bb133838b4862f985277775f55c9a4b48e92ba (patch) | |
tree | ddc4db9a8edaece67a06c67b9fd2eba5b29b9d6a /wee_slack.py | |
parent | 0f1613d5eac212e07b2751e7a999656afc642443 (diff) | |
download | wee-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.py | 4 |
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 |