Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Monocle works by wrapping a single generator and translating each yield-statement into a hand-off to the event loop or reactor and resuming when the value of the deferred becomes known.

Since the code is confined to a single generator, it's not easy to factor-out the steps into subroutines. PEP 380 provides a syntax for having sub-generators which can potentially be used to factor your code into smaller, reusable components.

PEP 380 is about providing better support for nested generators including the scaffolding with try/finally, g.send(), g.next(), g.throw(), and g.close().

In short, PEP 380 lets you nest, and nesting lets you factor your code.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: