Methods uses method attributes of the self argument : Class self : Class PYTHON examples


PYTHON examples » Class » Class self »

 

Methods uses method attributes of the self argument



class Bag:
    def __init__(self):
        self.data = []
    def add(self, x):
        self.data.append(x)
    def addtwice(self, x):
        self.add(x)
        self.add(x)

a = Bag()

a.add(4)
           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Class
» Class self