buggie in else syntax ?

stef mientki stef.mientki at gmail.com
Tue Aug 14 23:24:00 CEST 2007


hello,

I've the idea that the "else" syntax is not always handled correctly,
or I'm overlooking something.

This pieces of code are automatic translation from another language,
sometimes it works, sometimes it doesn't ???

This piece of code works nice:

    a = 2

    def JSM (line_nr):
          print line_nr

    if a>3:
        print 'asddas'
    else: JSM(230) ; \        <== this is the problem line, that's ok here
        print 'aaps'

While this piece of code gives a syntax error:

    #Function button_antidender(bit in pin,sbyte in out
    Button_Counter_Temp,byte in demp) return bit is
    def button_antidender ( pin, button_counter_temp, demp ):
         #serial_hw_write(counter)
        Serial_HW_Write ( button_counter_temp )                 ;JSM(226)
        if JSM(227) and (   button_counter_temp >= 0 ):
            if JSM(228) and (  pin == on ):
                button_counter_temp =  button_counter_temp  +  1   
    ;JSM(229)
            else: JSM(230) ;
    \                                                <=== SYNTAX ERROR
                button_counter_temp = 1                            
    ;JSM(231)

Traceback (most recent call last):
  File "D:\data_to_test\JALsPy\JALsPy.py", line 347, in ?
    Run_JALsPy_Application ()
  File "D:\data_to_test\JALsPy\JALsPy.py", line 327, in 
Run_JALsPy_Application
    JG.app.MainLoop()
  File "D:\data_to_test\JALsPy\JALsPy.py", line 255, in MainLoop
    import JAL_simulation_file
  File "D:\data_to_test\JALsPy\JAL_simulation_file.py", line 265
    else: JSM(230) ; \

I guess it's not the preferred syntax, but the resemblance with the 
original language it optimal.
Why is it sometimes accepted an sometimes give an error message ?

thanks,
Stef Mientki





More information about the Python-list mailing list