Initialize variable depending on another variables type
Question: In Python 2.7 I want to intialize a variables type depending on another
variable.

For example I want to do something like:

    
    
    var_1 = type(var_2)
    

Is there a simple/fast way to do that?


Answer: Just create another instance

    
    
    var_1 = type(var_2)()
    

Note that if you're not sure whether the object has a non-default constructor,
you cannot rely on the above, but you can use `copy` or `deepcopy` (you get a
"non-empty" object.

    
    
    import copy
    var_1 = copy.copy(var_2)  # or copy.deepcopy
    

You could use both combined with the latter as a fallback mechanism

Note: `deepcopy` will ensure that your second object is completely independent
from the first (If there are lists of lists, for instance)

