Tuesday, June 19, 2007

Circular imports

So in moving a function to solvers.py, I recently came across an interesting phenomenon in python. It's very well-illustrated here:
http://www.thescripts.com/forum/thread22561.html

It boils down to the fact that you can't do circular imports except in a specific manner. Now, I'm not one for hacking around this specific type of behaviour - I think you can just restructure the code so as not to do this - but what is the reasoning for why this works with "import *" but not with "from * import *". Interesting....

- C