[PyAR2] Loop? Sockets?

W W srilyk at gmail.com
Fri Feb 15 20:28:42 CET 2008


I have a question about efficiency I suppose it is.

I'm experimenting with a chat type program, and here's question:

Would it be considered efficient to run an infinite loop continually opening
and reading a file, say

while True:
   f = open('convo.txt', 'r')
   f = f.readlines()
   print f

Or some variant of that? Or are there sockets(?) or something that would
work better? Basically I just want to be able to open it whenever the file
is changed, so that seems like overkill (and probably a waste of cycles).


To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn't. - Primo Levi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/mailman/private/pyar2/attachments/20080215/0ab82142/attachment.htm 

More information about the PyAR2 mailing list