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:[email protected]]
> Sent: 25 March 2011 15:15
> To: J.Fine
> Cc: [email protected]
> 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 <[email protected]> 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
> > [email protected]
> > http://mail.python.org/mailman/listinfo/soap
> >
>
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to