[Tutor] How to determine which function code is being called from

Danny Yoo dyoo at hashcollision.org
Thu Mar 6 20:16:54 CET 2014


On Thu, Mar 6, 2014 at 9:00 AM, Jignesh Sutar <jsutar at gmail.com> wrote:
> Hi I'm trying to exclude a certain line of code if the function is called by
> another function, see illustration below:
>
>
> def funcA():
>     print "running from funcA" # print only if running from funcA
>     print "running from funcA or funcB" #print when running from either
> function
>     print "running from funcB" # print only when running from funcB
>
> def funcB():
>     funcA()
>
> funcB()



Can you directly pass the state that funcA cares about as an explicit parameter?

I think we need to understand what you're trying to do in context.
Tell us more why you want to do what you're doing.  Maybe the approach
you're taking is correct, or maybe there's an easier way to accomplish
what you're trying to do.


More information about the Tutor mailing list