[Python-ideas] explicitation lines in python ?

Daniel DELAY danieldelay at gmail.com
Sun Jun 27 08:52:48 CEST 2010

Le 26/06/2010 04:58, Stephen J. Turnbull a écrit :
> the more verbose
>      htmltable = ''.join('<tr>{}</tr>'.format(htmlline) for line in table) \
>          with htmlline = ''.join('<td>{}</td>'.format(cell) for cell in line)
> looks better.  Note that the "with" clause becomes an optional part of
> an assignment statement rather than a suite controlled by the
> assignment, and the indentation is decorative rather than syntactic.
This syntax on one line is interesting if we see "refinement" as a way 
to make more readable a too long line.

But I'm not sure wether this syntax is compatible with nesting different 
levels of refinement in a recursive way, as I did in an example.

Using "with" as an optional part of assignment seems to me rather 
restrictive, as too complex expressions may appear anywhere involving an 
expression, not only where expressions are assigned to a variable with "=".



More information about the Python-ideas mailing list