Lambda going out of fashion

Jp Calderone exarkun at divmod.com
Thu Dec 23 11:30:54 EST 2004


On Thu, 23 Dec 2004 10:19:33 -0600, Skip Montanaro <skip at pobox.com> wrote:
>
>     >> readability. Pythonic lambdas are just syntactic sugar in practice,
> 
>     Paul> Actually it's the other way around: it's named functions that are
>     Paul> the syntactic sugar.
> 
> While I'm sure it can be done, I'd hate to see a non-trivial Python program
> written with lambda instead of def.

  What, like this?

(lambda r,p,b:(r.listenTCP(6665,(type('F',(p.Factory,object),{'protocol':(type('P',(b.LineReceiver,object),{'connectionMade':lambda s:s.factory.c.append(s),'lineReceived':lambda s,m:(s.factory.m(m),None)[1]})),'c':[],'m':lambda s,m:[c.sendLine(m)for c in s.c]}))()),r.run()))(*(lambda p,i:(i(p,'reactor'),i(p,'protocol'),i('twisted.protocols.','basic')))('twisted.internet.',lambda a,b:__import__(a+b,None,None,b)))

  OTOH, maybe that's still trivial, it's only a multiuser network chat server, after all.

  plumbing-the-depths-ly,

  Jp



More information about the Python-list mailing list