[Soap-Python] Why the 'self' parameter in soap decorated methods?

J.Fine j.fine at open.ac.uk
Fri Mar 25 16:22:01 CET 2011


Thanks, Chris, for your answer.  However, it doesn't tell me why make it instance rather than static.

Are there any circumstances in which it would be sensible for say_hello or some similar method to use the self argument?


Jonathan

> -----Original Message-----
> From: Chris Austin [mailto:chris at sydneysys.com]
> Sent: 25 March 2011 15:15
> To: J.Fine
> Cc: soap at python.org
> Subject: Re: [Soap-Python] Why the 'self' parameter in soap
> decorated methods?
>
> Hi Jonathan,
>
> Self is in the method signature for say_hello because it is
> an instance method of  HelloWorldService.  The soap decorator
> does not coerce the say_hello method into a static or class
> method. Nor does the other web-method decorators (@rpc & @document).
>
> Hope this helps.
>
> On Fri, Mar 25, 2011 at 7:23 AM, J.Fine <j.fine at open.ac.uk> wrote:
> > Hi
> >
> > On the page
> > http://soaplib.github.com/soaplib/2_0/pages/helloworld.html I read
> >
> > class HelloWorldService(DefinitionBase):
> >    @soap(String,Integer,_returns=Array(String))
> >    def say_hello(self,name,times):
> >        results = []
> >        for i in range(0,times):
> >            results.append('Hello, %s'%name)
> >        return results
> >
> >
> > What's the purpose of the 'self' in the say_hello method.
> Are there any examples of it being used?
> >
> > (I should add that I'm an experienced Python programmer,
> and know the
> > purpose of self, and for that matter the staticmethod decorator.)
> >
> > Best regards
> >
> >
> > Jonathan
> >
> > --
> > The Open University is incorporated by Royal Charter (RC
> 000391), an exempt charity in England & Wales and a charity
> registered in Scotland (SC 038302).
> >
> > _______________________________________________
> > Soap mailing list
> > Soap at python.org
> > http://mail.python.org/mailman/listinfo/soap
> >
>


More information about the Soap mailing list