consistent handling of comments

This commit is contained in:
Martin Diehl 2020-11-12 21:31:09 +01:00
parent dd44714387
commit e15678e7a4
1 changed files with 3 additions and 2 deletions

View File

@ -31,7 +31,7 @@ class Table:
def __repr__(self):
"""Brief overview."""
return util.srepr(self.comments)+'\n'+self.data.__repr__()
return '\n'.join(['# '+c for c in self.comments])+'\n'+self.data.__repr__()
def __len__(self):
"""Number of rows."""
@ -159,7 +159,7 @@ class Table:
comments = [util.execution_stamp('Table','from_ang')]
for line in content:
if line.startswith('#'):
comments.append(line.strip())
comments.append(line.split('#',1)[1].strip())
else:
break
@ -222,6 +222,7 @@ class Table:
dup.data[label] = data.reshape(dup.data[label].shape)
return dup
def add(self,label,data,info=None):
"""
Add column data.