[Tutor] Working with Python Objects
Dinesh B Vadhia
dineshbvadhia at hotmail.com
Fri Mar 14 18:37:13 CET 2008
I've avoided it as long as possible but I've reached a stage where I have to start using Python objects! The primary reason is that the web framework uses objects and the second is to eliminate a few globals. Here is example pseudo code followed by the question (one of many I suspect!):
class A:
constantA = 9
def OneOfA:
<do something>
a = <do something else>
class B:
variableB = "quick brown fox"
def OneOfB:
<do something>
b = <do something more>
c = b * a # the 'a' from def OneOfA in class A
Question:
1) how do I access the 'a' from function (method) OneOfA in class A so that it can be used by functions (methods) in class B?
Cheers
Dinesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080314/1427d601/attachment.htm
More information about the Tutor
mailing list