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

[Python-Dev] dict comps

[Python-Dev] dict comps [Python-Dev] dict compsPaul Svensson paul-python@svensson.org
Fri, 26 Oct 2001 10:01:56 -0400 (EDT)
On Thu, 25 Oct 2001, Jeremy Hylton wrote:

>We agreed yesterday that the dictionary() constructor would accept a
>a list of two-tuples (strictly speaking an iterable object of iterable
>objects of length 2).  That plus list comprehensions pretty much
>covers the territory of dict comprehensions:
>
>>>> print dictionary([(i, chr(65 + i)) for i in range(4)])
>{0: 'A', 1: 'B', 2: 'C', 3: 'D'}
>

Wouldn't it be nice to be able to spell that

	{ i: chr(65 + i) for i in range(4) }

		/Paul




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