Anyone? Is using local_import to import a class into a model/controller just as safe as using 'from a import A' (i.e., in terms of memory leaks), or do you have to use the Python import statement directly?
On Tuesday, February 1, 2011 5:25:51 PM UTC-5, Anthony wrote: > But what if 'local_import' is used (instead of 'from a import Foo') -- does > local_import work the same as regular Python imports? > > On Tuesday, February 1, 2011 5:09:25 PM UTC-5, Massimo Di Pierro wrote: > >> I run this test (following Armin's example): >> >> # in file a.py >> class Foo(object): >> def __del__(self): >> print 'Deleted' >> >> #in file b.py >> from a import A >> foo=Foo() >> >> #in file c.py >> execfile('b.py', {}) >> execfile('b.py', {}) >> execfile('b.py', {}) >> import gc >> gc.collect() >> >> running c.py printes >> Deleted >> Deleted >> Deleted >> >> therefore there is NO memory leak. >> >> On Feb 1, 3:08 pm, VP <vtp...@gmail.com> wrote: >> > One question: >> > If I define a class externally, and use local_import to import it into >> > controller or model, will it have these potential problems or not? > >