Class functions

Jason Orendorff jason at jorendorff.com
Tue Feb 26 17:56:00 EST 2002


Chat Maine wrote:
> I'd like to access the data updated in real time via a class' function.

Chad,

Your source code doesn't provide quite enough information for
us to give you good advice.  (It actually sounds like you want
Python 2.2's generators, but I'm not sure I believe that.)

Here is one easy way to do this...

# theclass.py
class MyClass:
    ...
    ...
    def func(self):
        return UPDATE

# mainprogram.py
x = theclass.MyClass()
data = x.func()
while data != '':
    print data
    data = x.func()

I may be missing the point, though...

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list