command pattern is associated with three componentsthe clientthe invokerand the receiver let' take look at all the three components clientthe client represents the one that instantiates the encapsulated object invokerthe invoker is responsible for deciding when the method is to be invoked or called receiverthe receiver is that part of the code that contains the instructions to execute when corresponding command is given sample python implementation for demonstrating this patternwe are going to do python implementation of an example present on wikipedia in ++/java/cexample description it' the implementation of switch it could be used to switch on/off it should' be hard-coded to switch on/off particular thing ( lamp or an enginepython code class switch""the invoker class""def __init__(selfflipupcmdflipdowncmd)self __flipupcommand flipupcmd www testingperspective com