Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python: Classes

📅 2009-Oct-06 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

self is needed everywhere!

class foobar:
    def __init__(self): # Constructor
        self.val = True
    def foobar(self):   # Class method
        print(self.val)