reference counting for garbage collection

Paul Brian paul1brian at yahoo.com
Mon Dec 10 14:13:06 EST 2001


Dear all,

I am getting confused over object references/pointers etc....

If I create a function :

def foo(server):
    ''' creates a connection to server and returns it'''
    conn = mycleverconnection(server)
    return conn

and then I do

x = foo('10.x.x.x.')

will the function foo still keep some reference to conn such that

del(x)

will *not* destroy conn but conn will still stay alive?

if not

1) is there some tool that shows me what exactly is alive in the python
environment
2) is there some notes on references, keep alives and other mysterious
things in the docs
3) what have I done wrong in the stuff I just wrote (no not the above:-)?

(Ok so 3 is my problem :-)






More information about the Python-list mailing list