The switch to a set to handle the tasks in TaskQueue means we don't get duplicate tasks, at the expense of my_set.pop() returning arbitrary entries.
OrderedDict has the best of both worlds:
- keys remain unique, so we can
_put a task using my_dict['task_info'] = None and it will replace the same entry, and retain the same index position in the dict.
- there is the
my_dict.popitem(last=False) to _get a task in a FIFO sense.
Easy to add.