Deleting object in function
        Posted  
        
            by wrongusername
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by wrongusername
        
        
        
        Published on 2010-03-16T00:49:47Z
        Indexed on 
            2010/03/16
            0:59 UTC
        
        
        Read the original article
        Hit count: 429
        
Let's say I have created two objects from class foo and now want to combine the two. How, if at all possible, can I accomplish that within a function like this:
def combine(first, second):
    first.value += second.value
    del second #this doesn't work, though first.value *does* get changed
instead of doing something like
def combine(first, second):
    first.value += second.value
in the function and putting del second immediately after the function call?
© Stack Overflow or respective owner