Re: Problem with Axiom?
"Chaz." <[email protected]> Mon, 28 Aug 2006 06:29:05 -0400
| Newsgroups | gmane.comp.python.quotient.dev |
|---|---|
| Message-ID | <[email protected]> |
Jean-Paul Calderone wrote: > On Sun, 27 Aug 2006 16:51:28 -0400, "Chaz." <[email protected]> wrote: >> I am having a strange problem and I am not sure of exactly where the >> problem lies. It could be my python code, it could be axiom, I just >> don't know. >> > > Keeping a global Store like this is complex and error prone. You should > instantiate a Store in a function, probably your main function, and then > pass it as an argument to the other parts of your program. > > The particular problem you are running into with the example code you > included is that bar is being imported by Store initialization, which > causes it to import globaldb before globaldb is set to anything. > > Jean-Paul > > _______________________________________________ > Divmod-dev mailing list > [email protected] > http://divmod.org/users/mailman.twistd/listinfo/divmod-dev > Certainly your suggestion will allow me to overcome the problem but it doesn't explain why, when 'wwGlobalDB' and 'wwLocalDB' are removed and the code runs, that it works. Only when I don't delete it does it fail. This is pretty strange. Suppose I have aa.py a = None def foo(b): global a a = b b.py from aa import a def bar(): print a c.py import aa import b a.foo(23) b.bar() Why is this code incorrect? Wouldn't I see 23 printed? Chaz