Hello,
I am very surprising by the Python interpreter behavior : see code
I initialize a 'A' and a 'B', and i give a B instance reference to the  
instance A in 'm1' method. I can modify (IN/OUT mode)  the 'i' attribute  (  
aB.i = 10 ) , BUT I CANNOT DELETE "aB" into the fonction m1 ! the code "     
del aB " or " aB= None" has no effect. 'aB' still exists when m1() is finsihed! 
WHY ? How can i do that?
Thank you.
Zorgi


class A(object):
       def __init__(self):
        pass
    def m1 (self, aB ):
        aB.i = 10
        del aB
        print "no more B"
        
class B(object):
    def __init__(self,i):
        self.i = i
    def __del__(self):
        print "delete B"

aA = A ()
aB = B ( i = 6)

unA.m1 (aB )
print str( aB .i )  #--->  Display 10, aB is not destroy !



             
---------------------------------
 Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to