Design Pattern Examples
Overview of object-oriented design patterns
proxy_exercise.py
Go to the documentation of this file.
6
7from .proxy_class import Proxy_Classes_Container
8
9
24
25# ! [Using Proxy in Python]
27 print()
28 print("Proxy Exercise")
29
30 print(" Getting proxy object...")
31 proxyObject = Proxy_Classes_Container.CreateProxy()
32
33 print(" Calling Dowork() on proxy...")
34 output = proxyObject.DoWork("Initial call")
35 print(" Output from proxy = \"{0}\"".format(output))
36
37 print(" Calling Dowork() on proxy...")
38 output = proxyObject.DoWork("Second call")
39 print(" Output from proxy = \"{0}\"".format(output))
40
41 print(" Calling Dowork() on proxy...")
42 output = proxyObject.DoWork("Third call");
43 print(" Output from proxy = \"{0}\"".format(output))
44
45 print(" Done.")
46# ! [Using Proxy in Python]
def Proxy_Exercise()
Example of using the Proxy Pattern.