def __str__()

in pachi_py/pachi/tools/sgflib/sgflib.py [0:0]


	def __str__(self):
		""" SGF representation, with proper line breaks between properties."""
		if len(self):
			s = ";" + str(self[0])
			l = len(string.split(s, "\n")[-1])	# accounts for line breaks within Properties
			for p in map(str, self[1:]):
				if l + len(string.split(p, "\n")[0]) > MAX_LINE_LEN:
					s = s + "\n"
					l = 0
				s = s + p
				l = len(string.split(s, "\n")[-1])
			return s
		else:
			return ";"