[SciPy-user] OpenOpt svn broken on Windows

Matthieu Brucher matthieu.brucher@gmail....
Wed Jul 16 15:01:30 CDT 2008


2008/7/16 dmitrey <dmitrey.kroshko@scipy.org>:
> Matthieu Brucher wrote:
>>> __solverPaths__ is exported by runProbSolver.py, and than converted from None to
>>> dict. I intended to init it in runProbSolver.py but some issues had
>>> appeared (Python reported of bugs) so I had moved it to ooMisc.py
>>>
>>
>> It has not been moved to ooMisc. The actual registry is only available
>> in runProbSolver. Because you are initializing it in runProbSolver and
>> not in ooMisc.
>>
> What is not been moved to ooMisc?! I have said I encountered bugs while
> creating __solverPaths__ in runProbSolver, so now it's created in ooMisc
> (as None). Of course, then I redefine it as Python dict (in runProbSolver).

Try and get the type of ooMisc.__solverPaths__. It will always be
None. Why ? Because you import the variable None as __solverPaths__ in
rPS. Then you modify the reference, but not the underlying variable.

Try this:

module1.py

s = "Something"

module2.py

import module1.s

module1.s = "Something else"

module3.py

from module1 import s
s = "Something else"

And now

>>> import module1
>>> module1.s
Something
>>> import module2
>>> module1.s
Something else

Try the same with module3
>>> import module1
>>> module1.s
Something
>>> import module3
>>> module1.s
Something

This is exactly your case.

This question showed up on the python-list ML. At first, I didn't
understand either, but if you're thinking about references to
variables, you can understand what is really going on.

Matthieu
-- 
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher


More information about the SciPy-user mailing list