Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Python has always fully supported C style braces out of the box: you simply have to put a # before them:

    if foo == 1: # {
        print "one foo"
    # }
It also supports PASCAL style begin/end:

    if foo == 1: # begin
        print "one foo"
    # end
And it's fully internationalized, even supporting mixing multiple languages:

    if foo == 1: # beginnen
        print "one foo"
    # 終了
In fact, you can even mix styles:

    if foo == 1: # begin
        print "one foo"
    # }
Or optionally leave one of them out, or spell them any way you like, if you feel like it:

    if foo == 2:
        print "one foo"
    # fi
Even verbose COBOL style:

    if foo == 1: # perform conditional foo value check
        print("one foo")
    # end perform conditional


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: