New submission from Nicholas Chammas: Here is the user interaction:
```python $ python3 Python 3.5.1 (default, Dec 7 2015, 21:59:10) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> def oh_hai(): ... await something() File "<stdin>", line 2 await something() ^ SyntaxError: invalid syntax ``` It would be helpful if Python could tell the user something more specific about _why_ the syntax is invalid. Is that possible? For example, in the case above, an error message along the following lines would be much more helpful: ``` SyntaxError: Cannot call `await` inside non-`async` method. ``` Without a hint like this, it's too easy to miss the obvious and waste time eye-balling the code, like I did. :-) ---------- components: Interpreter Core messages: 258879 nosy: Nicholas Chammas priority: normal severity: normal status: open title: Provide more helpful error message when `await` is called inside non-`async` method versions: Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26188> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com