Class functions

Chad Maine chad.maine at broadlink.com
Tue Feb 26 18:16:00 EST 2002


Yeah, my function runs a loop looking for updates and posting them to a
StringIO file object.  I want access to that file object in real time in my
client instead of waiting for the function to "return".


"Jason Orendorff" <jason at jorendorff.com> wrote in message
news:mailman.1014764563.7542.python-list at python.org...
> 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