Beginner's question - class definition

Andreas Jung andreas at andreas-jung.com
Mon Jan 15 16:42:13 EST 2001


On Mon, Jan 15, 2001 at 09:14:20PM +0000, banksam at swanhill.net.au wrote:
> Can anyone explain please why the following definition ( from the
> Python documentation)
> 
> class Complex:
> 	def _init_(self, realpart, imagpart):
> 		self.r = realpart
> 		self.i = imagpart
> 
> when followed by the following attempt to create an instance
> 
> x = Complex(3.0,-4.5)

Stupid typo ! The constructor is __init__(self,...) 

Andreas 




More information about the Python-list mailing list