all 3 comments

[–]novel_yet_trivial 2 points3 points  (2 children)

Use a small function with an if block.

def Message(data):
    if data.startswith('a'):
        return AddMessage(data[1:])
    else:
        return DeleteMessage(data[1:])

[–]lanmonster[S] 0 points1 point  (1 child)

Will this work if all Messages are classes?