[Tutor] initialization of classes.

Furmanek, Greg Greg.Furmanek@hit.cendant.com
Mon, 12 Feb 2001 12:41:27 -0500


This worked.

Thanks

-> -----Original Message-----
-> From: Ibraheem Umaru-Mohammed [mailto:ibraheem@micromuse.com]
-> Sent: Monday, February 12, 2001 10:19 AM
-> To: Furmanek, Greg
-> Cc: 'tutor@python.org'
-> Subject: Re: [Tutor] initialization of classes.
-> 
-> 
-> Hi,
-> 
-> 
-> On Mon, Feb 12, 2001 at 11:57:09AM -0500, Furmanek, Greg wrote:
-> > Here is a Problem:
-> > 
-> > I am trying to pass a class to another class and 
-> > initialize the passed class if it is not passed
-> > when the main class is initialized.  
-> > 
-> > This is the piece of code and error I get.
-> > 
-> > Thanks for help.
-> > 
-> > #============  Code Start ==============================
-> > 
-> > class connection:
-> > 
-> > 
-> > 	def __init__ \
-> > 		(self, \
-> > 		l_acc_stat = "", \
-> > 		l_user_info = c_user_info(), \
-> 
-> c_user_info is not defined at this point -  move the definition
-> of c_user_info above (i.e. before ) the definition of connection. 
-> You will probably then find that "user_group" (and the other 
-> undefined
-> functions)are not well....defined. 
-> 
-> > 		l_tun_type = "", \
-> > 		l_acc_info = c_acct_info(), \
-> > 		l_net_info = c_network_info()):
-> > 
-> > 		self.account_status = l_acc_stat
-> > 		self.user = l_user_info
-> > 		self.Class = ""				# not used
-> > 		self.Tunnel_Type = l_tun_type
-> > 		self.acct_info = l_acc_info
-> > 		self.network_info = l_net_info
-> > 
-> > 
-> > 	def load_account_status(self, acc_stat):
-> > 		self.account_status = acc_stat
-> > 
-> > 
-> > 	def load_user_info(self, l_user_info):
-> > 		self.user = l_user_info
-> > 
-> > class c_user_info:
-> > 
-> > 
-> > 	def __init__(self):
-> > 		self.User_Name = ""
-> > 		self.User_Full_Name = ""
-> > 		self.User_Group = user_group 
-> 
-> Kindest regards,
-> 
-> 	--ibs.
-> 	
-> -- 
-> -------------------------------------------------------------
-> -------------------
-> 			--  Ibraheem Umaru-Mohammed  --
-> 			--  Email:ium@micromuse.com  --
-> -- Micromuse PLC, Disraeli House, 90 Putney Bridge Road, 
-> London SW18 1DA --
-> 			--  http://www.micromuse.com --
-> -------------------------------------------------------------
-> -------------------
-> 
-> _______________________________________________
-> Tutor maillist  -  Tutor@python.org
-> http://mail.python.org/mailman/listinfo/tutor
-> 


"The sender believes that this E-mail and any attachments were free of any
virus, worm, Trojan horse, and/or malicious code when sent.  This message
and its attachments could have been infected during transmission.  By
reading the message and opening any attachments, the recipient accepts full
responsibility for taking protective and remedial action about viruses and
other defects.  The sender's employer is not liable for any loss or damage
arising in any way from this message or its attachments."