"Michael Bernhard Arp Sørensen" <[EMAIL PROTECTED]> 
wrote

> I've read what to wrote about the *parentheses*. I see why I was 
> wrong in my
> premature assumption. but I fail to understand why it did work.

I suspect that if you look closely you'll find that the "testing" 
print statement
came after the "hello world" rather than before it.

    def test_callback(self, this_callback):
        print "testing the callback"
        this_callback

> Anyway, I removed the parentheses from the game method and added it 
> in the
> userinput method. It still works. Do I dare say that I'm "there" 
> now? :-)

I hope so, and it should now display the "testing" message before
the "hello" message. As to whether you are "there" yet that really 
depends
on whether you are comfortable that you understand the concept 
clearly.

Can you modify the program *without modifying the classes* to use an
ordinary function as the callback? Say this goodbye function:

def goodbye():
     print "goodbye world"

This should not require more than 5 lines of new code and no changes 
to the
existing code. It could be done in 3...

If you succeed then I'll be happy that you've grasped it.

Alan G. 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to