[PATCH 1 of 7] minirst: generate tables as a list of lines
Matt Mackall
mpm at selenic.com
Wed May 30 16:08:43 CDT 2012
On Sat, 2012-05-26 at 17:43 +0200, Olav Reinert wrote:
> # HG changeset patch
> # User Olav Reinert <seroton10 at gmail.com>
> # Date 1337799357 -7200
> # Node ID 5699ef4b5bd06e8685dd598e01ed46bee56e8ddc
> # Parent 869328a917f726dafc396c9824160dcf85b50bf7
> minirst: generate tables as a list of lines
The motivation for this change can't be inferred from its description.
I can only guess that the theory here is to make all of the RST
processing work on lists of strings so that we can avoid doing += string
growth.
But I really dislike the '\n'.join() idiom. Consider:
"\n".join(['foo', 'bar']) -> no trailing newline
"\n".join([]) -> empty string
Which means you can't unconditionally add a newline to the join result
to get the right result because the empty list shouldn't give you a
single newline result. Therefore it's much tidier to:
a) make sure each entry in your list has a newline to startwith
b) ''.join(list)
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list