[Python-Dev] Let's send lambda to the shearing shed (Re: Let's just *keep* lambda)
Georg Brandl
g.brandl at gmx.net
Thu Feb 9 22:38:49 CET 2006
Bengt Richter wrote:
>>1) Replace lambda args: value with
>>
>> args -> value
>>
>>or something equivalently concise, or
>>
> Yet another bike shed color chip:
>
> !(args:expr) # <==> lambda args:expr
> and
> !(args::suite) # <==> (lambda args::suite)
Please drop it. Guido pronounced on it, it is _not_ going to change,
and the introduction of new punctuation is clearly not improving anything.
> (where the latter lambda form requires outer enclosing parens) But either "::" form
> allows full def suite, with indentation for multilines having left edge of single indent
> defined by first line following the "::"-containing line, and explicit returns for values
> required and top suite ending on closing outer paren)
>
> Probable uses for the "::" form would be for short inline suite definitions
> !(x::print x) # <==> (lambda x::print x) & etc. similarly
Use sys.stdout.write.
> !(::global_counter+=1;return global_counter)
> !(::raise StopIteration)() # more honest than iter([]).next()
Use a function.
> but the flexibility would be there for an in-context definition, e.g.,
>
> sorted(seq, key= !(x::
> try: return abs(x)
> except TypeError: return 0))
Bah! I can't parse this. In "!(x::" there's clearly too much noise.
Georg
More information about the Python-Dev
mailing list