lambdak: multi-line lambda implementation in native Python

Roy Smith roy at panix.com
Sat Jan 17 12:20:35 EST 2015


In article <54ba5a25$0$12991$c3e8da3$5496439d at news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:

> Whitespace is significant in nearly all programming languages, and so it
> should be. Whitespace separates tokens, and lines, and is a natural way of
> writing (at least for people using Western languages).

>>> """x""" == " " "x" " "
False

> *Indentation* is significant to Python, while most languages enable tedious
> and never-ending style wars over the correct placement of braces vis a vis
> indentation, because their language is too simple-minded to infer block
> structure from indentation. Python does derive block structure from
> indentation, as god intended (otherwise he wouldn't have put tab keys on
> typewriters) and so Python doesn't suffer from the interminable arguments
> about formatting that most other languages do.

Well, we do get to argue about

x = [1,
     2,
     3]

vs.

x = [1,
     2,
     3,
    ]

vs. a few other variations based on how you group the first element with 
the opening bracket, or the last element with the closing bracket, and, 
of course, whether you use the last trailing comma or not.



More information about the Python-list mailing list