On Tue, 11 Jul 2000, Greg Wilson wrote: > (either now or in future). Would it also permit: > > [{x:y} for x in (1,2,3) for y in (4,5,6)] > > i.e. dict construction using list comprehension? I'd use this in quite a > few places. The above would produce [{1: 4}, {1: 5}, {1: 6}, {2: 4}, {2: 5}, {2: 6}, {3: 4}, {3: 5}, {3: 6}] If, on the other hand, you tried to make a single dictionary with {x: y for x in (1, 2, 3) for y in (4, 5, 6)} it doesn't make a lot of sense (multiple y's for the same x?). The only thing i could imagine it producing, perhaps, is {1: 6, 2: 6, 3: 6} -- ?!ng
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