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-October/039362.html below:

[Python-Dev] product()

[Python-Dev] product()Barry Warsaw barry at python.org
Thu Oct 23 07:59:11 EDT 2003
On Wed, 2003-10-22 at 21:43, Raymond Hettinger wrote:
> In the course of writing up Pep 289, it became clear that
> the future has a number of accumulator functions in store.

In a crazy, I-haven't-yet-had-my-coffee-yet desperate attempt at
resurrecting PEP 274, what if we made dict (and maybe tuple) accumulator
functions too?  Then if something like dict(genex) would work, how hard
would it be to add some syntactic sugar for that in {genex}?  Aren't we
kind of close already?

>>> from __future__ import generators
>>> def a():
...   for x in 'hello world':
...    yield x
... 
>>> dict([(c, c) for c in a()])
{' ': ' ', 'e': 'e', 'd': 'd', 'h': 'h', 'l': 'l', 'o': 'o', 'r': 'r', 'w': 'w'}

Okay, I promise, I'll shut up now about PEP 274.

pass-the-joe-ly y'rs,
-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20031023/628f09a2/attachment.bin
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