<br><br> <br><br><div class="gmail_quote">On Fri, Jan 16, 2009 at 14:56, greg whittier <span dir="ltr"><<a href="mailto:greg@thewhittiers.com">greg@thewhittiers.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
In python, the name of a function is just a pointer to it. Try this<br>
<br>
>>> def foo():<br>
print "Hi!"<br>
<br>
<br>
>>> class Problem:<br>
def __init__(self,fun):<br>
self.fun = fun<br>
<br>
<br>
>>> p1 = Problem(foo)<br>
>>> p2 = Problem(foo)<br>
>>> foo<br>
<function foo at 0x012C52B0><br>
>>> p1.fun<br>
<function foo at 0x012C52B0><br>
>>> p2.fun<br>
<function foo at 0x012C52B0><br>
>>> p1.fun == p2.fun<br>
True<br>
>>><br></blockquote><div><br><br>Wow!!! I thought that the question was simple but I was afraid that the answer was going to be too complex.<br><br>But I see that it actually works like I thought it should!!! It's extremely simple and intuitive, IMHO.<br>
<br>Thank you to all for your precise and clear answers. I've learned a lot, and specially appreciate the links that Kent provided.<br></div></div><br>I hope I can contribute to this forum in the future.<br><br clear="all">
<br>-- <br>Vicent<br>