]> khamidou — GitHub mirrors - scaletool.git/commitdiff
cleaned dup code
authorkhamidou <khamidou@gmail.com>
Thu, 11 Aug 2011 12:26:08 +0000 (14:26 +0200)
committerkhamidou <khamidou@gmail.com>
Thu, 11 Aug 2011 12:26:08 +0000 (14:26 +0200)
scales.py

index c066d8eb711b4b87b3abfcac35e060ff36746284..9ee7a24c86bdbd01b45e0c7297111a61dd22a721 100644 (file)
--- a/scales.py
+++ b/scales.py
@@ -83,15 +83,10 @@ class Scale:
                i = 0
                j = 0
                while i < 11 and j < 6: # reduce(lambda x,y: x+y, self.values)
-                       note = notes[i]
-                       if self.formula[j] == 1:
-                               retscale += notes[i+1]
-                               i += 1 
-                       elif self.formula[j] == 2:      
-                               retscale += notes[i+2]
-                               i += 2 
-
-                       j += 1
+                       n = self.formula[i]
+                       retscale += notes[i+n]
+                       i += n 
+                       j += 1 # Don't forget to increment j to avoid looping.
                        retscale += " "
                return retscale