Message282760
| Author |
Eric Appelt |
| Recipients |
Eric Appelt, ned.deily, yselivanov |
| Date |
2016年12月09日.04:54:43 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1481259288.58.0.348260724225.issue28091@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I think this needs considerable checking and polishing, but I am submitting this "Work In Progress" patch for the PEP525 and PEP530 documentation so that I can get some general feedback since I am new to this, and to ensure that if this is not generally what was needed or expected I don't delay the effort.
I tried to start where possible by using the wording in corresponding generator sections, so this may err on the side of redundant phrasing, which I can change.
I had some difficulty with the following points, and am not sure if they merit opening other tickets:
1. In PEP525 the documentation for aclose() is a bit terse and unclear to me. It appeared to suggest that you could catch GeneratorExit and yield, but I found this to result in a RuntimeError like a normal generator. I tried to document this as it actually behaves.
2. One thing that I noticed documented about normal generators is that they raise a ValueError if you try to run send() while another send() call is currently running. I verified this using threads. I looked into corresponding behavior for asynchronous generators, calling asend(), running the awaitable halfway through, and then calling asend() again to get a second awaitable before the first one finished. Asyncio seems to prevent more than one awaitable from a single async generator running at the same time, but I couldn't figure out how. Running some coroutines "by hand" calling asend() and send(), I was permitted to run multiple awaitables concurrently which produced odd results.
I did not attempt to document the behavior in (2) in the submitted patch. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年12月09日 04:54:49 | Eric Appelt | set | recipients:
+ Eric Appelt, ned.deily, yselivanov |
| 2016年12月09日 04:54:48 | Eric Appelt | set | messageid: <1481259288.58.0.348260724225.issue28091@psf.upfronthosting.co.za> |
| 2016年12月09日 04:54:48 | Eric Appelt | link | issue28091 messages |
| 2016年12月09日 04:54:47 | Eric Appelt | create |
|