Reinhold Kainhofer escreveu: > Attached is a git diff to translate articulations from MusicXML to lilypond. > It's basically the patch from yesterday with a few style-fixes as requested > by Han-Wen. > > Cheers, > Reinhold > > PS: If anyone needs an ubuntu package for guile 1.8.2, I have built one to be > able to build lilypond. > + def direction_mod (self): + dirstr = '' + try: + dirstr += { 1: '^', -1: '_', 0: '-' }[self.force_direction] + except KeyError: + pass + return dirstr
use {}.get (..) +def musicxml_direction_to_indicator (direction): + returnval = None + try: + val = { "above": 1, "upright": 1, "below": -1, "downright": -1 }[direction]; idem + str += ':%s' % 2**( 2 + string.atoi (self.bars) ) no space inside ( ) + try: + dir = musicxml_direction_to_indicator (mxl_event.placement) + #dir = mxl_event.type + if ( dir ): + ev.force_direction = dir + except (KeyError, ValueError, AttributeError): + pass + return ev don't use except() for control flow. exceptions are for exceptional situations only This programming style can easily hide programming errors. also, no spaces inside ( ) , and no () around the if condition. -- Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel