functon invoke or not

skyworld chenyong20000 at gmail.com
Wed Jan 9 09:50:31 CET 2013


On 1月9日, 下午4时46分, Mitya Sirenef <msire... at lightbird.net> wrote:
> On Wed 09 Jan 2013 03:23:56 AM EST, skyworld wrote:
>
> > Hi,
>
> > I see someone's code as this:
>
> > class ABC: ....
> >      def __init__(self, env):
> >           .......
> >           self.jmpTable['batchQ']['submit_job']  = self.lsf_submit
> >           .......
> >      def lsf_submit(self, cmd,env):
> >           .....
>
> > what confused me is why there is no parentheses for self.lsf_submit in
> > "self.jmpTable['batchQ']['submit_job']  = self.lsf_submit"? what does
> > this piece of code mean? thanks.
>
> Presumably it will be called at a later point:
>
> def f(): print 'foo'
>
> lst = [f]
> # la la
> lst[0]()
>
> HTH,  -m
>
> --
> Lark's Tongue Guide to Python:http://lightbird.net/larks/

Thanks for both of your replies. I got it.



More information about the Python-list mailing list