Re: Question about object lifetime and access

2014-01-15 Thread Asaf Las
First of all many thanks to all for their detailed answers on subject. I really appreciate it! > Correct. The global name is a reference, so the reference count will be > > at least 1. In fact, referencing the name from a function or method > doesn't increase the ref count: > -- > > Steven

Re: Question about object lifetime and access

2014-01-15 Thread Steven D'Aprano
On Wed, 15 Jan 2014 05:14:59 -0800, Asaf Las wrote: > I have read somewhere that global objects are referenced from module > namespace will never have reference count down to 0 even if they are not > referenced from functions or class methods. Is this true? Correct. The global name is a referenc

Re: Question about object lifetime and access

2014-01-15 Thread Asaf Las
Thanks! On Wednesday, January 15, 2014 3:05:43 PM UTC+2, Chris Angelico wrote: > > > > Questions are: > > > - what is the lifetime for global object (p in this example). > > > - will the p always have value it got during module loading > > > - if new thread will be created will p be accessible

Re: Question about object lifetime and access

2014-01-15 Thread Asaf Las
Thanks a lot for detailed answer! i plan to assign object to name only when module loads, that means outside of function or class method. Then object will be accessed from functions only for read purpose. I have read somewhere that global objects are referenced from module namespace will nev

Re: Question about object lifetime and access

2014-01-15 Thread Chris Angelico
On Wed, Jan 15, 2014 at 11:13 PM, Asaf Las wrote: > Questions are: > - what is the lifetime for global object (p in this example). > - will the p always have value it got during module loading > - if new thread will be created will p be accessible to it > - if p is accessible to new thread will ne

Re: Question about object lifetime and access

2014-01-15 Thread Ned Batchelder
On 1/15/14 7:13 AM, Asaf Las wrote: Hi community i am beginner in Python and have possibly silly questions i could not figure out answers for. Below is the test application working with uwsgi to test json-rpc. from multip

Question about object lifetime and access

2014-01-15 Thread Asaf Las
Hi community i am beginner in Python and have possibly silly questions i could not figure out answers for. Below is the test application working with uwsgi to test json-rpc. from multiprocessing import Process from werkze