Skip to content

modified the proxy.py. #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 22, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class SalesManager:

def work(self):
print("Sales Manager working...")

Expand All @@ -14,7 +13,6 @@ def talk(self):


class Proxy:

def __init__(self):
self.busy = 'No'
self.sales = None
Expand All @@ -30,14 +28,32 @@ def work(self):
print("Sales Manager is busy")


class NoTalkProxy(Proxy):
def __init__(self):
Proxy.__init__(self)

def work(self):
print("Proxy checking for Sales Manager availability")
time.sleep(2)
print("This Sales Manager will not talk to you whether he/she is busy or not")


if __name__ == '__main__':
p = Proxy()
p.work()
p.busy = 'Yes'
p.work()
p = NoTalkProxy()
p.work()
p.busy = 'Yes'
p.work()

### OUTPUT ###
# Proxy checking for Sales Manager availability
# Sales Manager ready to talk
# Proxy checking for Sales Manager availability
# Sales Manager is busy
# Proxy checking for Sales Manager availability
# This Sales Manager will not talk to you whether he/she is busy or not
# Proxy checking for Sales Manager availability
# This Sales Manager will not talk to you whether he/she is busy or not