lambdak: multi-line lambda implementation in native Python

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Jan 17 07:48:35 EST 2015


Marko Rauhamaa wrote:

> Jussi Piitulainen <jpiitula at ling.helsinki.fi>:
> 
>>  a+ b  => 7  # a() + b
>>  a +b  => 3  # a(+b)   => a(b) => a(1) = 1 + 2
>>
>> I'm not quite fond of such surprise in programming language syntax.
> 
> Yes, whoever came up with the idea of whitespace having syntactic
> significance!

Yes, we should go back to the rules of ancient FORTRAN, where:

DO100X=1.10,2

and

DO 100 X = 1. 10, 2

mean exactly the same thing.

Not.


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).

*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.



-- 
Steven




More information about the Python-list mailing list