On 17 August 2017 at 02:55, Yury Selivanov <yselivanov...@gmail.com> wrote: > And immediately after I hit "send" I realized that this is a bit more > complicated. > > In order for Tasks to remember the full execution context of where > they were created, we need a new method that would allow to run with > *both* exec and local contexts: > > class Task: > > def __init__(self, coro): > ... > self.local_context = sys.new_local_context() > self.exec_context = sys.get_execution_context() > > def step(): > > sys.run_with_contexts(self.exec_context, self.local_context, > self.coro.send)
I don't think that's entirely true, since you can nest the calls even without a combined API: sys.run_with_execution_context(self.exec_context, sys.run_with_local_context, self.local_context, self.coro.send) Offering a combined API may still make sense for usability and efficiency reasons, but it isn't strictly necessary. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/