~skeeto/public-inbox

1

Re: Exactly-Once Initialization in Asynchronous Python

Jakub Wilk
Details
Message ID
<20200801074855.ohxibl2i2pmglrr4@jwilk.net>
DKIM signature
missing
Download raw message
In the first example in the "Once" section, the "future" variable should 
be declared as global; otherwise you get:

    UnboundLocalError: local variable 'future' referenced before assignment

-- 
Jakub Wilk

Re: Exactly-Once Initialization in Asynchronous Python

Details
Message ID
<20200801120849.cbmc7rjk7ryluhh3@nullprogram.com>
In-Reply-To
<20200801074855.ohxibl2i2pmglrr4@jwilk.net> (view parent)
DKIM signature
missing
Download raw message
Fixed. Thanks, Jakub! I *had* tested all the concepts in a real program, 
but when writing the article I retyped all the code from memory. Even 
with years of working with it, I'm still routinely caught off-guard by 
Python's global and nonlocal declarations.
Export thread (mbox)