Skip to content

Adding async and await support for Python 3.5 #274

Open
@gamesbrainiac

Description

@gamesbrainiac

Hi guys!

With the advent of async and await keywords in Python 3.5, I think we need to add some convenience methods to the connection object that is returned when we make a r.connect(... function call. This would not be difficult to do, because we can already do a yield r.connect anyways.

So, the proposal is to add an __await__ method to the connection object. This will not be hard to implement though, as you can see with aiohttp's await implementation:

@asyncio.coroutine
def __iter__(self):
    resp = yield from self._coro
    return resp
if PY_35:
    def __await__(self):
        resp = yield from self._coro
        return resp

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions