I sing the praises of lambda, my friend and savior!

Antoon Pardon apardon at forel.vub.ac.be
Wed Oct 13 09:39:37 CEST 2004


Op 2004-10-12, Clark C. Evans schreef <cce at clarkevans.com>:
> On Tue, Oct 12, 2004 at 08:19:55AM +0000, Antoon Pardon wrote:
>| Op 2004-10-11, Jeff Shannon schreef <jeff at ccvcorp.com>:
>| > gabriele renzi wrote:
>| >> then what you want is a better lambda. One where you can use return, 
>| >> maybe, and  where you can have statements and multiple expressions.
>| >> Don't throw away the baby with the bathwater.
>| >
>| > But because of Python's line- and indentation-based syntax, doing all of 
>| > that on a single line is... um... awkward at best, to put it mildly.  
>| 
>| Which is one of the reasons I think the indentation-based syntax was
>| a mistake. If the syntax becomes an argument against a construct
>| in the language, something is wrong with the syntax IMO.
>
> Indentation based structure is a godsend; a divine insight if you may.
> Python is much much better for it.

That's your opinion I disagree.

I find it especially annoying when I work interactively. I sometimes
copy and paste something from an other window and it is just frustrating
to get a syntax error back just because you had copied an extra space
in front of the expression.

> However, just beacuse it can use
> indentation, doesn't mean that indentation should be mandated for every
> case.  Python uses {} and [] to scope dict and list items, but this does
> not mean that a indentation based version of this wouldn't be welcome.
> In general, indentation is great for "outer-structure" that is, 
> delimiting large code blocks.  While delimiter based scoping is good
> for inner structures, small blocks of code.  It should not be an 
> either/or thing, one should properly have the option of using either
> option depending upon which style brings the most clarity.

Well it isn't an either/or thing and I have seen it often enough that
a proposed language structure was argued against because fitting it
in the indentation-based syntax was going to be difficult/awkward or
something like that. Suppose for the sake af the argument that someone
comes up with a language structute that has almost everyone agree with
that it would be usefull to include in the language. However the
most natural indentation for the structure would be something like this:

  start:

      code

    control:

      code

    control:

      code

I fear that alone would kill the possibility of including it in
python.

-- 
Antoon Pardon



More information about the Python-list mailing list