diff --git a/langkit/templates/python_api/module_py.mako b/langkit/templates/python_api/module_py.mako index 846e91aa7..a3ce9e04e 100644 --- a/langkit/templates/python_api/module_py.mako +++ b/langkit/templates/python_api/module_py.mako @@ -316,7 +316,10 @@ class Token(ctypes.Structure): return self._sloc_range.wrap() def __repr__(self): - return "".format(self.text) + return ''.format( + self.kind, + ' {}'.format(repr(self.text)) if self.text else '' + ) class Sloc(object):