Open amnaredo opened 2 years ago
apart from pprint.pprintln(t: T, width: Integer = null, ...), why not a pprint.toString(t: T, width: Integer = null, ...)?
pprint.pprintln(t: T, width: Integer = null, ...)
pprint.toString(t: T, width: Integer = null, ...)
I understand that pprintln is streamed and it can print very large instances, but a toString method is also useful.
pprintln
toString
I can make a pull request with such a code (to be tested) if you like:
def toString[T: PPrint](t: T, width: Integer = null, height: Integer = null, indent: Integer = null, colors: Colors = null) (implicit cfg: Config = Config.Defaults.PPrintConfig): String = { tokenize(t, width, height, indent, colors)(implicitly[PPrint[T]], cfg).mkString }
ID: 176 Original Author: dportabella
Sure I can see the use. Let's call it stringify rather than toString, since toString is already pretty standard and has a meaning/signature that isn't what this is
stringify
Original Author: lihaoyi
apart from
pprint.pprintln(t: T, width: Integer = null, ...)
, why not apprint.toString(t: T, width: Integer = null, ...)
?I understand that
pprintln
is streamed and it can print very large instances, but atoString
method is also useful.I can make a pull request with such a code (to be tested) if you like:
ID: 176 Original Author: dportabella