This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7.

If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release).

Module: core.async_helpers

Async helper function that are invalid syntax on Python 3.5 and below.

This code is best effort, and may have edge cases not behaving as expected. In particular it contain a number of heuristics to detect whether code is effectively async and need to run in an event loop or not.

Some constructs (like top-level return, or yield) are taken care of explicitly to actually raise a SyntaxError and stay as close as possible to Python semantics.

1 Function


asyncio has deprecated get_event_loop

Replicate it here, with our desired semantics:

  • always returns a valid, not-closed loop

  • not thread-local like asyncio’s, because we only want one loop for IPython

  • if called from inside a coroutine (e.g. in ipykernel), return the running loop

New in version 8.0.