Topy news - and a request for Python pretty-printing

Tim Peters tim.one at comcast.net
Sun Apr 14 17:32:30 EDT 2002


[François Pinard]
> ...
> Would someone happens to know if there is a pretty-printer for Python
> source _lines_, where I would find some inspiration maybe?  I do not need
> an indenter, there is no problem there.  The problem is to split a long
> Python line into many lines which would nicely represent the original,
> that is, for example, for which indentation stresses operator precedence.
> Cleverly breaking long string constants is also an interesting problem!

Sorry, I haven't heard of such a beast.  The closest I've seen is the "block
comment" reflowing facilities in various Python editors.  For very long
lines with clear structure (lists, tuples and dict constructors; function
calls), I suppose you could do a lot worse than to feed them to Emacs,
injecting a newline after every comma.  Then they'll line up the way Guido
would type them by hand <wink>.







More information about the Python-list mailing list