ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
[Tutor] How can I access a variable outside a class definition?
by A other posts by this author
Sep 29 2001 7:10PM messages near this date
[Tutor] Informacion de Interes | Re: [Tutor] How can I access a variable outside a class definition?
Hi,
How can I access a variable defined in one class outside this class 
? For example

I have two classes like below

#############################
class Complex:
 def __init__(self, realpart1,imagpart1,realpart2,imagpart2):
   self.r1 = realpart1
   self.i1 = imagpart1
   self.r2 = realpart2
   self.i2 = imagpart2
 def Add(self,r1,i1,r2,i2):
   self.sum=self.i1+self.i2
   ImSum=self.sum
   return ImSum
###########################
###########################
class Outside
 def MyFunction(self,ImSum)
  ...
  ...

########################

Is it possible to access,in the Outside class, a value of
the ImSum
that was return by 
Add function in that Complex class?


Thank you for help.
Ladislav



_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved