Python Forum

Full Version: copy list into variable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I want to fill the variable "__adress" with content:

class MyClass

    def __init__(self,**args):
        for key in argus:
            if key == "adress": 
                __adress = argus[key].copy()
I call it over:
tmpVar = MyClass(adress=["foo","bar"])
Why not use the simpler
class MyClass:
    def __init__(self, address):
        self.__address = list(address)