Created
May 25, 2017 13:30
-
-
Save parente/a4772297459f05e43e12a5820051431b to your computer and use it in GitHub Desktop.
Python issue 30473
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import collections | |
import datetime | |
import time | |
class Test(threading.Thread): | |
def run(self): | |
# OK! | |
dd = collections.defaultdict(lambda: datetime.datetime.now()) | |
print('works', dd['works']) | |
# Boom! | |
dd = collections.defaultdict(datetime.datetime.now) | |
print('does not work', dd['does not']) | |
if __name__ == '__main__': | |
t = Test() | |
t.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment