Skip to content

Commit

Permalink
Merge pull request #15 from foolswood/result_equality
Browse files Browse the repository at this point in the history
Add equality comparison to pargen Result object
  • Loading branch information
javawizard committed May 20, 2015
2 parents 6a47f4c + 2cb4c02 commit 1e4e542
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions parcon/pargen/__init__.py
Expand Up @@ -69,13 +69,14 @@ def __nonzero__(self):

__bool__ = __nonzero__

def __str__(self):
def __repr__(self):
if self:
return "<Result: %s with remainder %s>" % (repr(self.text), self.remainder)
else:
return "<Result: Failure>"

__repr__ = __str__

def __eq__(self, other):
return self.text == other.text and self.remainder == other.remainder


def failure():
Expand Down

0 comments on commit 1e4e542

Please sign in to comment.