Python's simplicity philosophy

Terry Reedy tjreedy at udel.edu
Mon Nov 17 22:01:17 EST 2003


"Alex Martelli" <aleax at aleax.it> wrote in message
news:P75ub.43095$hV.1657519 at news2.tin.it...
> Terry Reedy wrote:
> > Would the hypothetical
> > results = sequence.map(func x: x+23)
> > be any better?
>
> Just replacing the keyword 'lambda' with 'func'?  If you were
> designing a green-field language, and couldn't find any other way
> to express callable literals -- so it only came down to a 2-way
> choice between lambda and func as keywords with the same semantics,
> I guess I would suggest func as the lesser evil.

If such a change were plausibly within the boundaries changes allowed
for the as-yet hypothetical 3.0 (or 3000), and there were not a more
radical change that I preferred, I might seriously propose this.
Upgrading would be simple than most other code-break changes.

> > How about a very hypothetical (post ``==repr deprecation)
> > results = sequence..map(`x+23`)
>
> How would this notation imply that x is an argument rather than,
> say, a global?

The above was a minimal 'concept' proposal to test the aesthetics of
something structurally different from current 'lambda's.  I think I
would make all identifiers params by default, since I believe this to
be more common, and 'tag' non-locals, perhaps with one of the
reserved, as yet unused symbols.  Example: lambda x: x + y == `x + @y`
or `x+y@`.   Since expressions cannot assign, no global declaration is
needed.

Terry






More information about the Python-list mailing list