give the constructor some parameters to work with : Constructor : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Constructor »

 

give the constructor some parameters to work with


class FooBar: 
    def __init__(self, value=42)
        self.somevar = value 

f = FooBar('This is a constructor argument')
print f.somevar



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Class
» Constructor