How do can you make a variable static?

Aahz Maruch aahz at netcom.com
Sat Jun 26 12:06:32 EDT 1999


In article <3772AE33.AA764DFA at alliedsignal.com>,
H. P. Friedrichs <HPeter.Friedrichs at alliedsignal.com> wrote:
>
>Can anyone clarify? What's the workaround? For a variety of reasons I
>won't go into right now, I really can't pass the dictionary as an
>argument.

Just as a reminder, "pass the dictionary" actually means "pass a
*reference* to the dictionary"; if copying a huge block of memory is an
issue, that's simply not happening.

If you really want to do exactly what you're doing (and Darrell's
suggestion of using a class is far better), you could create something
like this (not tested, but I'm pretty sure it works):

*** module foo.py

def initFoo ( dict ) :
	global SymHanDict
	SymHanDict = dict

Now your Foo() function should work correctly if you call initFoo()
first in the main script.
--
                      --- Aahz (@netcom.com)

Hugs and backrubs -- I break Rule 6       <*>      http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het




More information about the Python-list mailing list