[Tutor] Program Slicing / Trace
Elisha Rosensweig
benshafat at gmail.com
Thu Jun 18 16:53:44 CEST 2009
It is not clear to me in what way line 3 is different than line 2 - both are
assignments... Please clarify
Elisha
On Thu, Jun 18, 2009 at 10:37 AM, Jojo Mwebaze <jojo.mwebaze at gmail.com>wrote:
> Hi Tutor
>
> The problem i have is to see which statements modify my data at execution
> time without referring to the code. Referring to the code is difficult esp
> because of branching. You can never tell before hand which branch execution
> will follow.
>
> e.g in the example below, statements 1, 2, 5,7 and 10 modify my data and
> are the ones i would like to trace during run time. However the other
> statements do not change my data so am not interested in them.
>
> How can this be achieved during execution? Not sure if the traceback module
> can be helpful here!
>
> Cheers
>
> Jojo.
>
> ===========================
>
> def myfunction():
> 1. num1= 20 #statement 1
> 2. num2 = 30 #statement 2
> 3. somelist= [ ] #statement 3
> 4. if (num1 < num2):
> 5. num2 = num2 * 20 #statement 3
> 6. else:
> 7 num2 = num1 + num2 #statement 3
> 8. mylist = [num1, num2] #statement 4
> 9. for items in mylist:
> 10. somelist.append( math.sqrt(item) + math.log(item)) #statement 5
> 11. return somelist
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090618/a98ade69/attachment.htm>
More information about the Tutor
mailing list