Parrot-0.0.1

Greg Ewing greg.ewing at compaq.com
Sun Sep 5 19:09:54 EDT 1999


Emile van Sebille wrote:
> 
> Off topic and probably obvious, but, how would you plug a function into
> an instance?
>
> Hoping-to-say-WOW-but-anticipating-a-slapped-forehead-ly yrs

class Foo:

  def f():
    self.g()

def h():
  print "Wow! (slap)"

x = Foo()
x.g = h
x.f()

Greg




More information about the Python-list mailing list