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

Danny Yoo dyoo at hashcollision.org
Fri Mar 7 12:45:12 CET 2014


> def funcB(runfromB):
>     funcA(runfromB=runfromB)
>
> funcB(runfromB=True)



Yes, this is something that might be appropriate.  But it really does
depends on your context.  Although many of the recommendations have
been discouraging the stack inspection approach, even stack inspection
might be appropriate, though it's certainly not a technique for
beginners.

That's why I think we need your context.  Can you say more about why
you're trying to do this?  You must be thinking of something more than
the funcA and funcB examples above.  Can you give us a scenario where
you want to do this?  It's an unusual request, so we'd like to know
more.


Good luck!


More information about the Tutor mailing list