Python tracing, doesnt show the indexes
<p>Hey people i just got a quick question, for some of you it might be very simple but please help out.
lets say we got:</p>

<pre><code>--- modulename: test, funcname: &lt;module&gt;
test.py(1): nums = [3, 1, 2, 10]
test.py(3): where = 0
test.py(5): for number in range(1, len(nums)):
test.py(7):   if nums[number] &lt; nums[where]:
test.py(9):      where = number
test.py(5): for number in range(1, len(nums)):
test.py(7):   if nums[number] &lt; nums[where]:
test.py(5): for number in range(1, len(nums)):
test.py(7):   if nums[number] &lt; nums[where]:
test.py(5): for number in range(1, len(nums)):
test.py(11): answer = nums[where]
 --- modulename: trace, funcname: _unsettrace
trace.py(80):         sys.settrace(None)}
</code></pre>

<p>So as you can see it doesn't show me the output i need. I need to see the numbers that its putting inside of each stage looping. Is there a way to get it done?</p>

<p>Add print statement where you want to see output.</p>

<p><strong>Version:</strong></p>

<pre><code>[root@dsp-centos ~]# python -V
Python 2.7.5
[root@dsp-centos ~]#
[root@dsp-centos ~]# python -m trace --version
trace 2.0
[root@dsp-centos ~]#
</code></pre>

<p><strong>Code :</strong></p>

<pre><code>nums = [33, 21, 4, 8]

where = 0

for number in range(1, len(nums)):
   print number
   if nums[number] &lt; nums[where]:

        where = number
        print where

        answer = nums[where]
        print answer
</code></pre>

<p><strong>Output:</strong></p>

<pre><code>    [root@dsp-centos ~]# python -m trace -t a.py
 --- modulename: a, funcname: &lt;module&gt;
a.py(3): nums = [33, 21, 4, 8]
a.py(5): where = 0
a.py(7): for number in range(1, len(nums)):
a.py(8):    print number
1
a.py(9):    if nums[number] &lt; nums[where]:
a.py(11):         where = number
a.py(12):         print where
1
a.py(14):         answer = nums[where]
a.py(15):         print answer
21
a.py(7): for number in range(1, len(nums)):
a.py(8):    print number
2
a.py(9):    if nums[number] &lt; nums[where]:
a.py(11):         where = number
a.py(12):         print where
2
a.py(14):         answer = nums[where]
a.py(15):         print answer
4
a.py(7): for number in range(1, len(nums)):
a.py(8):    print number
3
a.py(9):    if nums[number] &lt; nums[where]:
a.py(7): for number in range(1, len(nums)):
 --- modulename: trace, funcname: _unsettrace
trace.py(80):         sys.settrace(None)
[root@dsp-centos ~]#
</code></pre>

python tracing