function access to caller's symbols?

Lance E Sloan lsloan at yahoo.com
Fri Mar 9 14:12:40 EST 2001


I'm a Python newbie, so if I'm approaching this problem
the wrong way, let me know.

I defined a function that takes a string and a dictionary
as arguments.  I wanted the function to use the global
symbol table as the dictionary if it was not specified.
I defined it this way:

def myFunc(theString = None, theDict = vars()):

This worked fine when the function was defined in the
same file as the code that called it.  However, when I
moved the function to a different file and used "import"
to bring it in, it wouldn't work.  theDict in the function
didn't contain any of the symbols that were defined in
code that called the function.

So, how can I make my function access its caller's
symbol table?

Thanks in advance!


=====
Lance E Sloan
lsloan at bigfoot.com


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/




More information about the Python-list mailing list