drew moore
drew moore

Reputation: 32670

Correct way to call methods in a controller class

I'm relatively new to Python and working on a Pylons app.

Consider the following controller:

class FooController(BaseController): 

   def doFoo(self, fooArg): 
       #do stuff
       #return stuff

   def doBar(self, barArg): 
       self.doFoo(barArg) #call A 
       FooController.doFoo(self, barArg) #call B 

What (if anything) is the difference between call A and call B here?

Upvotes: 0

Views: 585

Answers (1)

Nafiul Islam
Nafiul Islam

Reputation: 82470

For your use case, nothing. Because when you do self.<method_call>, self is implicitly passed as the first parameter to FooContoller.doFoo(<self>, arg).

Upvotes: 1

Related Questions