non riusciva a capire come utilizzare attendono pitone 3.5-RC2Come usare l'espressione await?
>>> async def foo():
... pass
...
>>> await foo()
File "<ipython-input-10-a18cb57f9337>", line 1
await foo()
^
SyntaxError: invalid syntax
>>> c = foo()
>>> await c
File "<ipython-input-12-cfb6bb0723be>", line 1
await c
^
SyntaxError: invalid syntax
>>> import sys
>>> sys.version
'3.5.0rc2 (default, Aug 26 2015, 21:54:21) \n[GCC 5.2.0]'
>>> del c
RuntimeWarning: coroutine 'foo' was never awaited
>>>
Ho controllato [PEP 0492] (https://www.python.org/dev/peps/pep-0492/#examples-of-await-expressions) e sembra che dovrebbe essere valido. Potrebbero averlo cambiato o qualcosa del genere? – TigerhawkT3
Forse deve essere parte di [qualche più grande costrutto] (https://docs.python.org/3.6/whatsnew/3.5.html#pep-492-coroutines-with-async-and-await-syntax)? – TigerhawkT3
Hai letto questo? https://docs.python.org/3.6/reference/compound_stmts.html#async-def – JeromeJ