On Tue, 11 Oct 2016, 9:24 PM <[email protected]> wrote: > hello, > > i am calling a module which creates a variable, i dont need to return this > variable to the main script once the module is done its job. But does this > mean the next time the module is called that variable created before is > removed from memory? >
It seems that some of your terms are mixed up so it's hard to know what you might be referring to. Modules aren't callable, and are a container usually representing objects parsed from a file loaded into the interpreter (but there are other sources). Do you actually mean global variables in a module? Or do you mean local variables created within a function that lives within a module? Variables created in the global scope of the module will live for as long as the module stays loaded in the interpreter. This is really just a fancy term for it living in sys.modules, and also once no one keeps a reference to it. Variables created in the scope of a function body are local to that function and are destroyed when the stack frame of that function call is cleaned up, at the end of the function. > thanks, > Sam > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/7b37dd20-7c21-4ed7-9416-dc204537b415%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2mZRbELOtydUgSuKPnK1kxs9zUGnPfD5fkN04SfE_tqQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
