Recursive method

Ralph Gauges ralph.gauges at eml.villa-bosch.de
Wed Jul 14 10:52:18 EDT 1999


You are absolutely right. So far I had some methods in my
class and made the whole gui right inside the class
definition. This must have created some problems with
namespaces and 'self'. Now I moved the whole gui creation
inside the __init__ method and now 'self' works.
Now I have one more question: Why is there no 'self' right
inside the class definition?

class Test:
	def TestMethod(self):
		print "ABC"

	

	TestMethod()            # <- this doesn't work, because
TestMethod expects an argument (self)
	TestMethod(self)        # <- this doesn't work, because
there is no 'self'
	self.TestMethod()       # <- this doesn't work, because
there is no 'self'

	__init__(self):
		self.TestMethod() # <- now this works just fine


Thanks a lot for the help and I hope, somebody can come up
with an answer to this last question.

Ralph




More information about the Python-list mailing list