News for hackers. Stuff that matters.
Re:Bython: Python with braces. Because Python is awesome, bu... by stefanos82 on Monday March 11, 2024 @07:54AM (#39666966)
I was bitten so many times by un-indented code, thanks to copy / paste that took me hours for figure out what was the actual problem.

I wish Python had closing...how do we call them, tags(?), clauses?

Anyway, here's an example of what I mean:

Before:

    def IsPalindrome(s) -> bool:
        for i in range(len(s)):
            if s[i] != s[len(s)-1-i]:
                return False
        return True

    print("Is Anna a palindrome?", IsPalindrome('ANNa'.lower()))

after:

    def IsPalindrome(s) -> bool
        for i in range(len(s))
            if s[i] != s[len(s)-1-i]
                return False
            endif
        endfor
        return True
    enddef

    print("Is Anna a palindrome?", IsPalindrome('ANNa'.lower()))
Re:Bython: Python with braces. Because Python is awesome, bu... by zexbha on Monday March 11, 2024 @08:33AM (#39667379)
I like these end clauses but they can get cumbersome in heavily nested control structures. Ruby, I'm looking at you.
Re:Bython: Python with braces. Because Python is awesome, bu... by jerpint on Monday March 11, 2024 @08:23AM (#39667271)
Some editors display permanent indentation lines which help visually resolve the indentation
Re:Bython: Python with braces. Because Python is awesome, bu... by Chris2048 on Monday March 11, 2024 @09:01AM (#39667679)
I prefer this idea, but instead of a shell-style ending unique to every scoped structure, maybe just a ";" character?:

    def IsPalindrome(s) -> bool
        for i in range(len(s))
            if s[i] != s[len(s)-1-i]
                return False;
        ;
        return True;
I'd also be inclined to skip it for 'def' as well, since they tend not be be as nested.
Re:Bython: Python with braces. Because Python is awesome, bu... by jwineinger on Monday March 11, 2024 @10:39AM (#39668799)
why not braces then?
Re:Bython: Python with braces. Because Python is awesome, bu... by timbit42 on Monday March 11, 2024 @11:41AM (#39669574)
They either don't line up vertically, or take extra vertical space.
Re:Bython: Python with braces. Because Python is awesome, bu... by fortyseven on Monday March 11, 2024 @12:27PM (#39670202)
...what?
Re:Bython: Python with braces. Because Python is awesome, bu... by timbit42 on Monday March 11, 2024 @06:12PM (#39673831)
The braces.