Re:Python Generators in Depth
by haberman on Tuesday February 26, 2013 @12:25PM
(#5286959)
Another very nice and mind-bending presentation on coroutines, that eventually takes things so far that he creates a mini "OS" with coroutines as tasks, complete with system calls and a scheduler: http://dabeaz.com/coroutines/
[ Parent
| on HN ]
Re:Python Generators in Depth
by manaskarekar on Tuesday February 26, 2013 @01:08PM
(#5287237)
The talk by the same David Beazley on Co-routines: http://blip.tv/pycon-us-videos-2009-2010-2011/a-curious-cour...
The talk from David Mertz on Co-routines: https://www.youtube.com/watch?v=b7R3-_ViNxk
Wow that David Beazley presentation is annoying. He spends the first 10 minutes in the introduction, complaining about how he won't have enough time to go through his presentation.
I didn't watch the video, but going through the slides I was absolutely fascinated. I've been craving something new and advanced like this out of python for a while.
Thank you, I hadn't seen that. I've added that link to the bottom of my article.
You use "assert gen.next() is None", but asserts might be dropped by optimizations, see e.g. http://docs.python.org/release/2.5.2/ref/assert.html - and your code will break.
assert should only be used for debugging, and only for things that should never happen. side effects on assert is a no-no. (Also in C)