[Python-Dev] Let's send lambda to the shearing shed (Re: Let's just keep lambda) (original) (raw)
Georg Brandl g.brandl at gmx.net
Thu Feb 9 22:38:49 CET 2006
- Previous message: [Python-Dev] Let's send lambda to the shearing shed (Re: Let's just *keep* lambda)
- Next message: [Python-Dev] Let's just *keep* lambda
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
!(::globalcounter+=1;return globalcounter) !(::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
- Previous message: [Python-Dev] Let's send lambda to the shearing shed (Re: Let's just *keep* lambda)
- Next message: [Python-Dev] Let's just *keep* lambda
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]