[python-uk] (no subject)

Jaime Buelta jaime.buelta at gmail.com
Sat Apr 10 09:15:28 CEST 2010


You should "call" the function used as argument in "temp" (named val),  just
if you're calling directly "hello". This way:


def hello():
   print 'hello'
   return
def temp(val):
   val() # Note the brackets, as you're executing the function
   return
temp(hello)

I think this is what you are trying to achieve...

  Best regards,
     Jaime Buelta

On Thu, Apr 8, 2010 at 12:43 PM, anish thomas <thomas_anish at hotmail.com>wrote:

>  Hi Experts,
>
> Not sure , I am contacting the right alias for some clarifications on
> python.
> Am beginer and looking for your comments/suggestions on implementing call
> backs in python.
> I have the following sample code, where I am trying to execute "hello"
> using callbacks,but its not printing the value.
> Can someone please comment on it
>
> Regards
> Anish
>
>
> def hello():
>    print 'hello'
>    return
> def temp(val):
>    val
>    return
> temp(hello)
>
>
>
>
> ------------------------------
> Invest your money wisely post Budget Sign up now.<http://news.in.msn.com/moneyspecial/>
>
> _______________________________________________
> python-uk mailing list
> python-uk at python.org
> http://mail.python.org/mailman/listinfo/python-uk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-uk/attachments/20100410/afd588f1/attachment.html>


More information about the python-uk mailing list