• @qwop
    link
    21 year ago

    If it’s valid syntax you can technically do pretty much whatever you want at runtime with enough hacks. I know pytest does some pretty crazy stuff to get nicer error messages from asserts (e.g. so it can display the value of a and b for assert a == b)

    As soon as it’s invalid syntax it becomes harder. You can’t parse it into an ast, which I assume is why they used regex.