Godtone (talk | contribs)
m →My Python 3 code: weird bug
Godtone (talk | contribs)
→My Python 3 code: make custom decoration easier
Line 1,160: Line 1,160:
print('\n'.join([ striv(x) for x in scale ]))
print('\n'.join([ striv(x) for x in scale ]))


def interpret_edo(edo,ol=17,sg=[],no=[],add=[],styler=lambda x,relerr: striv(x) if abs(relerr) < 1/2 else '*'+striv(x)+'*'):
def interpret_edo(edo,ol=17,sg=[],no=[],add=[],styler=lambda x,relerr: striv(x) if abs(relerr) < 1/2 else '*'+striv(x)+'*',dec='*'):
if type(styler)==int or type(styler)==float:
considered_bad = styler if type(styler)==int or type(styler)==float else 1/2
considered_bad = styler
if considered_bad != 1/2 or dec != '*': # if a custom bound was provided instead of a styler or a decoration was provided
styler=lambda x,relerr: striv(x) if abs(relerr) < considered_bad else '*'+striv(x)+'*'
styler=lambda x,relerr: striv(x) if abs(relerr) < considered_bad else dec+striv(x)+dec[::-1]
# else use default styler if no custom decoration was provided and the styler is not a numeric type
print(edo,'EDO interpretation')
print(edo,'EDO interpretation')
if not sg:
if not sg: