Improve __repr__ for BaseDefinition and AbstractNameDefinition

This commit is contained in:
Daniel Hahler committed 2018-07-15 23:22:10 +02:00
1 parent 1e796fc08d
commit c4e2892100
2 files changed
+10 -4

No files matched your search

+5 -3
View File
@@ -34,9 +34,11 @@ class AbstractNameDefinition(object):
return self.parent_context.get_root_context()
def __repr__(self):
if self.start_pos is None:
return '<%s: %s>' % (self.__class__.__name__, self.string_name)
return '<%s: %s@%s>' % (self.__class__.__name__, self.string_name, self.start_pos)
return '%s(string_name=%r, start_pos=%r)' % (
self.__class__.__name__,
self.string_name,
self.start_pos,
)
def execute(self, arguments):
return self.infer().execute(arguments)