buggie in else syntax ?

Thomas Jollans thomas at jollans.com
Tue Aug 14 19:38:50 EDT 2007


On Tuesday 14 August 2007, stef mientki wrote:
> 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

is there a newline before the backslash ? Or a space after the backslash but 
before the newline ?

-- 
      Regards,                       Thomas Jollans
GPG key: 0xF421434B may be found on various keyservers, eg pgp.mit.edu
Hacker key <http://hackerkey.com/>:
v4sw6+8Yhw4/5ln3pr5Ock2ma2u7Lw2Nl7Di2e2t3/4TMb6HOPTen5/6g5OPa1XsMr9p-7/-6
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/python-list/attachments/20070815/39cd5daf/attachment.sig>


More information about the Python-list mailing list