Skip to content

Instantly share code, notes, and snippets.

@parente
Created May 25, 2017 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parente/a4772297459f05e43e12a5820051431b to your computer and use it in GitHub Desktop.
Save parente/a4772297459f05e43e12a5820051431b to your computer and use it in GitHub Desktop.
Python issue 30473
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