The code does not wait for the class to be initialized!

I have a block of code that basically initializes a few classes, but they are put in sequential order since the later ones mention the earlier ones.

For some reason, the latter is initialized before the first ... it seems like there is some thread going on. I need to know how can I stop it from doing this?

Is there a way to make the init class do something similar to sending the return value?

Or maybe I could use the class in the if statement to check if the class has already been initialized?

I'm a bit new to Python and am transitioning from C, so I'm still used to small differences like naming conventions.

+1


source to share


2 answers


Python before 3.0 has global locking, so everything runs in one thread and in sequence.



I am guessing that some side effect is initializing the last class from a different location than you would expect. Throw an exception in __init__

this last class to see where it is called.

0


source


Spaces and tabbed issues ... ugh. >. >



Well, at least it works now. I'll admit that I kind of left out the curly braces from C instead of forcing indentation. It's pretty handy as a prototyping language. Maybe I will love more when I get a better understanding of this.

0


source







All Articles