optimize: xrange instead of range

This commit is contained in:
Nikos Kouremenos 2005-10-27 12:47:54 +00:00
parent af826817fc
commit 1f1d87019f
5 changed files with 7 additions and 7 deletions

View File

@ -1346,7 +1346,7 @@ class Chat:
#we don't want size of the buffer to grow indefinately
max_size = gajim.config.get('key_up_lines')
if size >= max_size:
for i in range(0, size - 1):
for i in xrange(0, size - 1):
self.sent_history[jid][i] = self.sent_history[jid][i+1]
self.sent_history[jid][max_size - 1] = message
else:

View File

@ -136,7 +136,7 @@ class PreferencesWindow:
l.append(dir)
if l.count == 0:
l.append(' ')
for i in range(len(l)):
for i in xrange(len(l)):
preview = gtk.Image()
files = []
files.append(os.path.join(gajim.DATA_DIR, 'iconsets', l[i], '16x16', 'online.png'))
@ -1097,7 +1097,7 @@ class AccountModificationWindow:
self.proxy_combobox.set_model(model)
l = gajim.config.get_per('proxies')
l.insert(0, 'None')
for i in range(len(l)):
for i in xrange(len(l)):
model.append([l[i]])
if our_proxy == l[i]:
self.proxy_combobox.set_active(i)

View File

@ -388,7 +388,7 @@ Please specify account for sending the message.') % sys.argv[2])
is_float = True
else:
is_float = False
for i in range(len(value) - 1):
for i in xrange(len(value) - 1):
chr = value[i+1]
if chr == '.':
is_float = True
@ -410,7 +410,7 @@ Please specify account for sending the message.') % sys.argv[2])
_str = ''
previous_slash = False
slashes = 0
for i in range(len(value) - 1):
for i in xrange(len(value) - 1):
chr = value[i+1]
if previous_slash:
previous_slash = False

View File

@ -781,7 +781,7 @@ class RosterWindow:
'attached_gpg_keys').split()
keys = {}
keyID = 'None'
for i in range(0, len(attached_keys)/2):
for i in xrange(0, len(attached_keys)/2):
keys[attached_keys[2*i]] = attached_keys[2*i+1]
if attached_keys[2*i] == user.jid:
keyID = attached_keys[2*i+1]

View File

@ -98,7 +98,7 @@ class SystrayWINAPI:
cblist = self._message_map[key]
if isinstance(cblist, list):
if not len(cblist) < 2:
for i in range(len(cblist)):
for i in xrange(len(cblist)):
if cblist[i] == callback:
del self._message_map[key][i]
return