Skip to content

Instantly share code, notes, and snippets.

@atmb4u
Created April 12, 2015 09:36
Show Gist options
  • Save atmb4u/9d5dd4f943a5659f166f to your computer and use it in GitHub Desktop.
Save atmb4u/9d5dd4f943a5659f166f to your computer and use it in GitHub Desktop.
Function Pipelines with persistent State (FPS) - FPS programming
class WineBottle(object):
def __init__(self):
self.wine = 100
self.max_capacity = 500
self.make = "Plastic"
def add_wine(self, amount):
if self.max_capacity < self.wine + amount:
self.wine = self.max_capacity
print "OverFlow"
else:
self.wine += amount
print self.wine
def drink_wine(self, amount):
if amount > self.wine:
self.wine = 0
print "Finish"
else:
self.wine -= amount
print self.wine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment