[PyAR2] Loop? Sockets?

Chad Cooper Chad_Cooper at SWN.COM
Fri Feb 15 20:55:33 CET 2008

Could you somehow use the last modified time of the file? But you still have to keep constantly checking that timestamp.

 -----Original Message-----
From: 	W W [mailto:srilyk at gmail.com]
Sent:	Friday, February 15, 2008 01:52 PM Central Standard Time
To:	pyar2 at python.org
Subject:	[PyAR2] Loop? Sockets?


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 

Notice:  This e-mail may contain privileged and/or confidential
information and is intended only for the addressee. If you are not the
addressee or the person responsible for delivering it to the addressee,
you may not copy or distribute this communication to anyone else. If you
received this communication in error, please notify us immediately by
telephone or return e-mail and promptly delete the original message from
your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/mailman/private/pyar2/attachments/20080215/e8f4c5e9/attachment.htm 

More information about the PyAR2 mailing list