[Python-bugs-list] redefined class methods don't get passed a class instance (PR#212)

straznp@clarkson.edu straznp@clarkson.edu
Thu, 24 Feb 2000 22:14:53 -0500 (EST)


Full_Name: Nathan Straz
Version: 1.5.2
OS: Debian Linux (frozen)
Submission from: taz.woodstock.clarkson.edu (128.153.163.125)


Here, I'm trying to redefine a method by assigning to it a new function
definition.  It has the same parameters as the original definition, but when it
gets called after the assignment, I get "TypeError: not enough arguments;
expected 1, got 0"  Isn't the class instance supposed to be passed?

class A:
 def g(self):
  print self.h()
 def h(self):
  return "hi"

a1 = A()
a1.g()

a1.h = lambda self : "bye"
a1.g()