pep-0492: Rewrite "Why not a __future__ import" section; tx to Nick Coghlan.

This commit is contained in:
Yury Selivanov 2015-04-29 23:18:03 -04:00
parent 08ceef7eeb
commit c69cef2b6e
1 changed files with 5 additions and 8 deletions

View File

@ -1108,14 +1108,11 @@ coroutines from regular functions visually.
Why not a __future__ import Why not a __future__ import
--------------------------- ---------------------------
``__future__`` imports are inconvenient and easy to forget to add. `Transition Plan`_ section explains how tokenizer is modified to treat
Also, they are enabled for the whole source file. Consider that there ``async`` and ``await`` as keywords *only* in ``async def`` blocks.
is a big project with a popular module named "async.py". With future Hence ``async def`` fills the role that a module level compiler
imports it is required to either import it using ``__import__()`` or declaration like ``from __future__ import async_await`` would otherwise
``importlib.import_module()`` calls, or to rename the module. The fill.
proposed approach makes it possible to continue using old code and
modules without a hassle, while coming up with a migration plan for
future python versions.
Why magic methods start with "a" Why magic methods start with "a"