[Python-Dev] dict comps (original) (raw)
Jeremy Hylton jeremy@zope.com
Thu, 25 Oct 2001 17:15:39 -0400 (EDT)
- Previous message: [Python-Dev] [development doc updates]
- Next message: [Python-Dev] dict comps
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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'}
Jeremy
- Previous message: [Python-Dev] [development doc updates]
- Next message: [Python-Dev] dict comps
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]