Mega Code Archive

 
Categories / Python Tutorial / Class
 

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