0

I ran a python script to create a dict variable based on a database, and then I pickled this variable into disk file for later usage. Now I have a lot of feature classes which all need that variable to create different features. The thing is the dict variable is so large that cannot afford to import multiple times. I am wondering if there is a way I can unpickle and import that variable for only once, and then all feature class can share it?

1
  • why not define global variable assigne unpickled dict to it? Commented Apr 11, 2011 at 20:06

1 Answer 1

3

Python will only import the module once. Any code that executes at load time will only be executed the first time a file imports the module.

Sign up to request clarification or add additional context in comments.

1 Comment

I think this has the essence of a good answer, but is so brief that it is likely of little value to the OP (as well as many others lacking a solid Python background).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.