[Python-ideas] Tighten up the formal grammar and parsing a bit?

Hugh Fisher hugo.fisher at gmail.com
Mon May 15 05:38:29 EDT 2017


I wrote this little Python program using CPython 3.5.2. It's ...
interesting ... that we apparently don't need comments or pass
statements any more. Anyone else think it might be worth tightening up
the grammar definition and parser a bit?

def empty():
    """Don't do anything"""

def helloWorld():
    """Docstring"""
    x = 0
    if x > 0:
        """Pass"""
    else:
        x += 1
    print(x)
    """Comment that is a string or vice versa"""
    x = 2
    print(x)
    if x == 2:
        x += 1 ;"Add 1 to x"
    print(x)
    if x == 3:
        42
        print("Answered everything")


if __name__ == "__main__":
    helloWorld()
    print(empty())


-- 

        cheers,
        Hugh Fisher


More information about the Python-ideas mailing list