On Fri, Jan 16, 2009 at 7:51 AM, Vicent <vgi...@gmail.com> wrote:
>
> That "problem" has to contain, somehow, a property or element called 
> "function" which, in fact, I would like it to be a function, or a "pointer" 
> to a function.

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
>>>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to