Python: Classes

# self is needed everywhere!
class foobar:
    def __init__(self): # Constructor
        self.val = True
    def foobar(self):   # Class method
        print(self.val)
Advertisements