class DysFunctional(object): classData = {} one = 1 def __init__(self): self.two = 2 self.classData["three"] = 3 def count(self): four = 4 five = 4 five += 1 print self.one print self.two print self.classData["three"] print four print five def whatif(self, test): if test: print "yep" else: print "nope" def whatfor(self, data): result = [] for x in data: if x % 2: continue if x == 9: break result.append(x) else: print "nothing to see here" return result def dowhile(self): x = 1 while (x < 65536): x *= 2 print x else: print "can't a guy get a break?" def exceptional(self): try: raise Exception("oh no") except Exception, e: print "okay" finally: print "that wasn't so exceptional." def whatswrong(self): assert self.exceptional() is None assert self.whatif(True) is None assert self.whatif(False) is None assert self.whatfor(range(10)) == [0,2,4,6,8] assert self.whatfor(range(2)) == [0] assert self.dowhile() is None d = DysFunctional() d.whatswrong()