A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-December/040653.html below:

[Python-Dev] Re: "groupby" iterator

[Python-Dev] Re: "groupby" iterator [Python-Dev] Re: "groupby" iteratorGreg Ball gball at cfa.harvard.edu
Wed Dec 3 11:18:21 EST 2003
Would it work to generalise generator expressions in the following way:

(x[1] for x) == lambda x:x[1]
(x.score for x) == lambda x: x.score
(x+y for x,y) == lambda x,y: x+y
(len(x) for x) == lambda x,len=len: len(x)  # roughly equivalent

i.e. an anonymous block notation, with early binding semantics.  It could
work as a lambda replacement. But no-argument lambdas would require some
extra ugliness.

(1 for)  == lambda:1 #    yuck!
(1 for ()) == lambda:1 # better?


And should this be allowed?

((a,b) for a in l for b,l) == lambda b,l: ((a,b) for a in l)


--
Greg Ball





More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4