GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing mail.python.org — [Python-Dev] lambda (x, y): [Python-Dev] lambda (x, y):Serhiy Storchaka storchaka at gmail.comSat Jan 25 07:55:04 CET 2014
25.01.14 07:41, Greg Ewing написав(ла): > Brett Cannon wrote: >> >> On Fri, Jan 24, 2014 at 10:50 AM, Ram Rachum <ram at rachum.com >> <mailto:ram at rachum.com>> wrote: >> >> lambda (x, y): whatever >> >> http://python.org/dev/peps/pep-3113/ > > Part of the rationale in that PEP is that argument unpacking > can always be replaced by an explicitly named argument and > an unpacking assignment. No mention is made of the fact that > you can't do this in a lambda, giving the impression that > lambdas are deemed second-class citizens that are not worth > consideration. > > The author was clearly aware of the issue, since a strategy > is suggested for translation of lambdas by 2to3: > > lambda (x, y): x + y --> lambda x_y: x_y[0] + x_y[1] > > That's a bit on the ugly side for human use, though. > An alternative would be > > lambda xy: (lambda x, y: x + y)(*xy) > > Whether that's any better is a matter of opinion. There is open issue for this: http://bugs.python.org/issue16094
More information about the Python-Dev mailing list |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |