≈ the.bay.news

@durable: compile generators into picklable state machines

Discussions on Python.org
@durable: compile generators into picklable state machines
I want to pitch a @durable decorator. It takes a generator function and rewrites it into a generated class. Any local that’s still needed after a yield becomes an instance attribute, and a match on a program-counter field jumps back to the right checkpoint. What you end up with is a plain object that pickle can save and resume. I’m not trying to put storage or scheduling in the language. That stays in libraries. The bit I think only the language can do properly is the state machine itself, buil...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.