Merge. Reworked the added Command.__ne__ operator a bit for a tiny speed optimization (it's after all one of the most called methods in Evennia).

This commit is contained in:
Griatch 2012-11-03 19:21:19 +01:00
commit 8966f03713
9 changed files with 324 additions and 180 deletions

View file

@ -149,8 +149,15 @@ class Command(object):
return cmd in self._matchset
def __ne__(self, cmd):
"The logical negation of __eq__."
return not self.__eq__(cmd)
"""
The logical negation of __eq__. Since this is one of the
most called methods in Evennia (along with __eq__) we do some
code-duplication here rather than issuing a method-lookup to __eq__.
"""
try:
return not cmd.key in self._matcheset
except AttributeError:
return not cmd in self._matchset
def __contains__(self, query):
"""