On Fri, Jan 16, 2009 at 14:56, greg whittier <g...@thewhittiers.com> wrote:
> > In python, the name of a function is just a pointer to it. Try this > > >>> def foo(): > print "Hi!" > > > >>> class Problem: > def __init__(self,fun): > self.fun = fun > > > >>> p1 = Problem(foo) > >>> p2 = Problem(foo) > >>> foo > <function foo at 0x012C52B0> > >>> p1.fun > <function foo at 0x012C52B0> > >>> p2.fun > <function foo at 0x012C52B0> > >>> p1.fun == p2.fun > True > >>> > Wow!!! I thought that the question was simple but I was afraid that the answer was going to be too complex. But I see that it actually works like I thought it should!!! It's extremely simple and intuitive, IMHO. Thank you to all for your precise and clear answers. I've learned a lot, and specially appreciate the links that Kent provided. I hope I can contribute to this forum in the future. -- Vicent
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor