On Feb 24, 10:54 am, [email protected] wrote:
> * ** Accessing callers context from callee method**
> *
>
> when i call a method foo from another method func. can i access func context
> variables or locals() from foo
> so
> def func():
>   i=10
>   foo()
>
> in foo, can i access func's local variables on in this case i
> Thanks a lot

May ask why you want to do this? There might be an easier way to
accomplish whatever is you're trying to do.

I think it is possible, but not without doing some funky magic. You
might want to just use a class or pass local vars from func to foo.
Maybe foo(**locals())?

BTW, what you're calling "methods" look like functions in your example.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to