[Tutor] Simple Object Question

Tim Johnson tim@johnsons-web.com
Mon, 26 Feb 2001 18:30:57 -0900


Sorry..... I should not have sent the question below.
neglected the parens after the class instantiation.
Never mind! 
I've been coding in 3 different languages today.
duh~

Newbie Object Question
The following code with class 
###########################
#!/usr/bin/python
class cgitools:
	def __init__(self):	
		pass
	def header(self):
		print "Content-type: text/html\n\n"
	def __repr__(self):
		return self.header()
cgi = cgitools
cgi.header()
###########################
Generates the error message:
cgi.header()
TypeError: unbound method must be called with class instance 1st argument

I wish for cgi.header to print out the mime-type string.

Any advice would be appreciated.
TIA :)
--
Tim Johnson
-----------
"Of all manifestations of power,
 restraint impresses the most."
 -Thucydides