diff options
| author | Rapptz <[email protected]> | 2018-06-10 18:09:14 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-06-10 18:10:00 -0400 |
| commit | f25091efe1281aebe70189c61f9cac405b21a72f (patch) | |
| tree | d0d13dad1a89de9f45845a36ea475098b7a0b494 /docs/faq.rst | |
| parent | Add Message.jump_to_url (diff) | |
| download | discord.py-f25091efe1281aebe70189c61f9cac405b21a72f.tar.xz discord.py-f25091efe1281aebe70189c61f9cac405b21a72f.zip | |
Drop support for Python 3.4 and make minimum version 3.5.2.
Diffstat (limited to 'docs/faq.rst')
| -rw-r--r-- | docs/faq.rst | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/docs/faq.rst b/docs/faq.rst index 57daa471..506a4d43 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -15,27 +15,6 @@ Coroutines Questions regarding coroutines and asyncio belong here. -I get a SyntaxError around the word ``async``\! What should I do? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This :exc:`SyntaxError` happens because you're using a Python version lower than 3.5. Python 3.4 uses ``@asyncio.coroutine`` and -``yield from`` instead of ``async def`` and ``await``. - -Thus you must do the following instead: :: - - async def foo(): - await bar() - - # into - - @asyncio.coroutine - def foo(): - yield from bar() - -Don't forget to ``import asyncio`` on the top of your files. - -**It is heavily recommended that you update to Python 3.5 or higher as it simplifies asyncio massively.** - What is a coroutine? ~~~~~~~~~~~~~~~~~~~~~~ @@ -195,11 +174,6 @@ technically in another thread, we must take caution in calling thread-safe opera us, :mod:`asyncio` comes with a :func:`asyncio.run_coroutine_threadsafe` function that allows us to call a coroutine from another thread. -.. warning:: - - This function is only part of 3.5.1+ and 3.4.4+. If you are not using these Python versions then use - ``discord.compat.run_coroutine_threadsafe``. - However, this function returns a :class:`concurrent.Future` and to actually call it we have to fetch its result. Putting all of this together we can do the following: :: |