i try to set variables dependend on the type with an switch case statement.
I have a class rule with looks as following:
class rule:
    def __init__(self):
        name = ""
        src = ""
    def setName(self, name):
        self.__name = name
    def getName(self):
        return self.__name
    name = property(getName, setName)
    def setSrc(self, src):
        self.__src = src
    def getSrc(self):
        return self.__src
    src = property(getSrc, setSrc)
and a text file as following
option <type> <value>
option name myname
option src anysrc
I search for the string option and get the secound and third string. as far as good. e.g. (qick and dirty):
with open("file") as f:
    for line in f:
        if line.find('option') != -1:
            type(line.split(' ')[1], line.split(' ')[2])
Now I have write a switch case statement to set variable in object rule.
def type(option, value):
    switcher = {
        "name": rule.name = value,
        "src": rule.src = value,
    }
    switcher.get(option, lambda: "Invalid Option")
But this will not work, I face following:
  File "./read.py", line 112
    "name": rule.name = value,
                      ^
SyntaxError: invalid syntax
I have no idea how to solve this issue or how to solve this by an other way. Any idea how to solve this issue?
 
     
    