Manuel Naranjo committed 90bcf69

Allow Literal objects to be compared among each others.

This small change allows Literal objects to be compared, so that calls like for
example AppendUnique only append one instance when string compares to True
instead of duplicated values.

  • Participants
  • Parent commits 0c9c8af

Comments (0)

Files changed (1)


     def is_literal(self):
         return 1
+    def __eq__(self, other):
+        if not isinstance(other, Literal):
+            return False
+        return self.lstr == other.lstr
+    def __neq__(self, other):
+        return not self.__eq__(other)
 class SpecialAttrWrapper(object):
     """This is a wrapper for what we call a 'Node special attribute.'
     This is any of the attributes of a Node that we can reference from
     In practice, this might be a wash performance-wise, but it's a little
     cleaner conceptually...
     def __init__(self, list, func):
         self.list = list
         self.func = func
         self._create_nodelist = self._return_nodelist
         return self.nodelist
     _create_nodelist = _gen_nodelist
 class Targets_or_Sources(collections.UserList):
     """A class that implements $TARGETS or $SOURCES expansions by in turn
                             raise_exception(NameError(key), lvars['TARGETS'], s)
                             return ''
                     # Before re-expanding the result, handle
                     # recursive expansion by copying the local
                     # variable dictionary and overwriting a null