A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-August/149007.html below:

[Python-Dev] PEP 550 v4

[Python-Dev] PEP 550 v4 [Python-Dev] PEP 550 v4Yury Selivanov yselivanov.ml at gmail.com
Mon Aug 28 11:26:51 EDT 2017
On Sat, Aug 26, 2017 at 4:45 PM, francismb <francismb at email.de> wrote:
[..]

> it's by design that the execution context for new threads to be empty or
> should it be possible to set it to some initial value? Like e.g:
>
>      var = new_context_var('init')
>
>      def sub():
>          assert var.lookup() == 'init'
>          var.set('sub')
>
>      def main():
>          var.set('main')
>
>          thread = threading.Thread(target=sub)
>          thread.start()
>          thread.join()
>
>          assert var.lookup() == 'main'


Yes, it's by design.

With PEP 550 APIs it's easy to subclass threading.Thread or
concurrent.futures.ThreadPool to make them capture the EC.

Yury
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4