How can I create initialization code?
When I put the __init__
constructor always tell me that parameters are wrong.
Also please someone gave a example also using __new__
and one using super()
and why should we use or not use them.
import webapp2
class MainHandler( webapp2.RequestHandler ):
def __init__( self ):
#initialization code/vars
x = 1
def get( self ):
#code for get here
self.response.write( x+1 )
def post( self ):
#code for post here
self.response.write( x+2 )
app = webapp2.WSGIApplication ( [ ('/', MainHandler) ], debug=True )