Tweaks to use inplace arithmetic

svn: r13191
This commit is contained in:
Gerald Britton
2009-09-10 18:49:48 +00:00
parent d5e48cda06
commit 941fff23ae
31 changed files with 56 additions and 60 deletions

View File

@@ -87,11 +87,11 @@ class Citation(object):
number_of_letters = int(math.log(float(ref_count), float(letter_count)))+1
# Exclude index for number_of_letters-1
for n in range(1, number_of_letters-1):
ref_count = ref_count - pow(letter_count, n)
ref_count -= pow(letter_count, n)
# Adjust number_of_letters for new index
number_of_letters = int(math.log(float(ref_count), float(letter_count))) +1
for n in range(1, number_of_letters):
x_ref_count = x_ref_count - pow(letter_count, n)
x_ref_count -= pow(letter_count, n)
for letter in range(1, number_of_letters):
index = x_ref_count / pow(letter_count, letter) % letter_count
key += string.ascii_lowercase[ index ]