On Fri, Aug 12, 2011 at 11:58:53AM +0200, Pierre Chapuis wrote:
if x: doThings(x)
else: doThings(y)
I am not sure you can cleanly make this a one liner though.
Python 2.5 and later (don't have the older serpents around):
doThings(x) if x else doThings(y)
An approach I like to solve the problem and make everybody
happy is the one used by the Go language: whitespace is not
significant but there is a canonical indentation style and
a tool (gofmt) that enforces it.
The style used in PiL is a candidate.
I don't see a reason why this wouldn't work with Lua. It is
probably possible to make a parser that takes valid Lua code
and returns a canonical representation for it.
For example: if you make an entry in LuaWiki that contains in
its source
{{{!Lua
....
}}}
it would not merely highlight keywords as it does now, but also
do the indents. It would show up canonically, no matter how it
was typed in. Why not?
Dirk