dict object has no attribute iteritems
BBCMarkMcDonnell opened this issue · 2 comments
BBCMarkMcDonnell commented
Hello,
Here is a program I quickly put together in order to play around with Deco:
import collections
import time
from deco import concurrent, synchronized
@concurrent
def compute(x, y):
print("Compute %s + %s ..." % (x, y))
time.sleep(2)
return x + y
@synchronized
def print_sum():
results = collections.defaultdict(dict)
results[1] = compute(1, 2)
results[2] = compute(1, 2)
results[3] = compute(1, 2)
results[4] = compute(1, 2)
final_result = results[1] + results[2] + results[3] + results[4]
print("combined results {}".format(final_result))
print_sum()
Note: I know it's not great, but wanted something quick to play with
But I get the following error...
AttributeError: 'dict' object has no attribute 'iteritems'
...which suggests the code isn't suitable for Python 3 as per this Stack Overflow response to a similar error: http://stackoverflow.com/a/30418498
Am I mistaken, or missing something obvious?
Thanks.
alex-sherman commented
This had actually been brought up before, and is fixed in the latest version in master. Thanks for bringing this up though, it's a good reminder to make a new release on pip. I've uploaded a 0.4.1 version to PyPi which you should be able to get with pip install deco --upgrade
Integralist commented
Thanks that worked