facebook/tornado — pull request #915 by anton-ryzhov (2013-10-17 16:02:20+00:00)
Title: Yielding dicts from coroutine

New feature useful for creating dynamic YieldPoint lists.

```python
@gen.coroutine
def do_job(self, request_foo=False, request_bar=False):
http_client = AsyncHTTPClient()
tasks = dict(
tasks['always'] = http_client.fetch(self.always_url)
)
if request_foo:
tasks['foo'] = http_client.fetch(self.foo_url)
if request_bar:
tasks['foo'] = http_client.fetch(self.bar_url)

results = yield tasks

if request_bar:
results['bar'] = self.process_bar(results['bar'])
return results
```

Nowadays we have to create keys list separately from futures list, zip it after yielding, or write very complex statements:

```python
results = dict(zip(tasks.keys(), (yield tasks.values())))
```

instead of just:

```python
results = yield tasks
```