Kartic wrote:
[EMAIL PROTECTED] said the following on 1/30/2005 7:43 PM:

Hello,
I want to do the following:

def do_load(self, arg):
sitefile = file('sitelist', 'r+', 1)
while True:
siteline = sitefile.readline()
site_rawlist = siteline.split()
sitelist[site_rawlist[0]] = site_rawlist[1:]
if len(siteline) == 0:
break

You should move "if len(siteline) == 0" part right after your readline. The way you have done it really does not help.

Or better yet, don't use "if len(siteline) == 0" -- use "if siteline". See this an other examples of dubious Python:


http://www.python.org/moin/DubiousPython

Specifically, see the section on Overly Verbose Conditionals.

Steve
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to