Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Scala offer functionality similar to Pretty Print in Python?

Tags:

scala

pprint

Does Scala offer functionality similar to Pretty Print pprint in Python?

like image 215
defoo Avatar asked Apr 19 '11 19:04

defoo


1 Answers

No, it doesn't. Except for XML, that is -- there's a pretty printer for that, which generates interpreter-readable data.

In fact, it doesn't even have a way to print interpreter-readable data, mainly because of how strings are represented when converted to string. For instance, List("abc").toString is List(abc).

Add to that, there's no facility at all that will break them based on width, or ident nested collections.

That said, it is doable, within the same limits as pprint.

like image 133
Daniel C. Sobral Avatar answered Sep 26 '22 00:09

Daniel C. Sobral