Sorting bytes in words, tuples in python
<p>I looked around and I can't seem to find the proper way of sorting a 32 entry tuple by inverting every odd and even entry.</p>

<p>ex: </p>

<pre><code>1 0 3 2 5 4 7 6 9 8
to
0 1 2 3 4 5 6 7 8 9
</code></pre>

<p>My current code looks like this </p>

<pre><code>i=0
nd = []
while i &lt; len(self.r.ipDeviceName):
  print(i)
    if i%2:
      nd[i]=self.r.ipDeviceName[i-1]
    else:
      nd[i]=self.r.ipDeviceName[i+1]
dn = "".join(map(chr,nd))
devicenameText.SetValue(dn)
</code></pre>

<p>the type of self.r.ipDeviceName is tuple and I either get a <em>IndexError</em> or a <em>tuple doesn't suport assignation</em> depending on variations of the code</p>

<p>I also tried this with the same results</p>

<pre><code>nd = self.r.ipDeviceName
for i in nd:
    if i&amp;0x01:
        nd[i]=self.r.ipDeviceName[i-1]
    else:
        nd[i]=self.r.ipDeviceName[i+1]
dn = "".join(map(chr,nd))
devicenameText.SetValue(dn)
</code></pre>

<p>With the same results. Something very simple seems to elude me. Thanks for your help and time.</p>
