[issue28942] await expressions in f-strings

Adam Gregory report at bugs.python.org
Mon Dec 12 06:12:02 EST 2016


New submission from Adam Gregory:

Hi,

I've been playing with f-strings, which seem like a great addition to the language. I noticed in the definition of f_expression that it can include any or_expr. As far as I understand, this includes "await" expressions, so I tried using await inside an f-string in a coroutine with CPython 3.6.0b4. This produces a SyntaxError.

Should await be allowed in f-strings? I don't know if this is a bug or a documentation issue. Personally, I think it would be an occasionally useful feature - more so than yield, at least, which does work.

Ref: https://docs.python.org/3.6/reference/lexical_analysis.html#formatted-string-literals

----------
assignee: docs at python
components: Documentation, asyncio
messages: 282980
nosy: Adam Gregory, docs at python, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: await expressions in f-strings
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28942>
_______________________________________


More information about the Python-bugs-list mailing list