Python - Merge data from multiple thread instances
<p>I am currently working on a project that involves connecting two devices to a python script, retrieving data from them and outputting the data. </p>

<p>Code outline:</p>

<p>â¢   Scans for paired devices</p>

<p>â¢   Paired device found creates thread instance (Two devices connected = two thread instances )</p>

<p>â¢   Data is printed within the thread i.e. each instance has a separate 
bundle of data</p>

<p>Basically when two devices are connected two instances of my thread class is created. Each thread instance returns a different bundle of data.</p>

<p>My question is: Is there a way I can combine the two bundles of data into one bundle of data?</p>

<p>Any help on this is appreciated :)</p>

<p>My general advice: Avoid using any of these things </p>

<ul>
<li>avoid threads</li>
<li>avoid the multiprocessing module in Python</li>
<li>avoid the futures module in Python.</li>
</ul>

<p>Use a tool like <a href="http://python-rq.org/" rel="nofollow">http://python-rq.org/</a></p>

<p>Benefit:</p>

<ul>
<li>You need to define the input- and output data well, since only serializable data can be passed around</li>
<li>You have distinct interpreters.</li>
<li>No dead locks</li>
<li>Easier to debug.</li>
</ul>

python multithreading