[Tutor] How to determine which function code is being called from
spir
denis.spir at gmail.com
Thu Mar 6 19:51:47 CET 2014
On 03/06/2014 06:00 PM, Jignesh Sutar 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()
The simple way is to have a param telling about the caller. (But _probably_ you
don't _really_ need that, it is instead an artifact of unproper design.)
denis
More information about the Tutor
mailing list