cascading python executions only if return code is 0

Chris Angelico rosuav at gmail.com
Mon Dec 23 14:12:44 EST 2013


On Tue, Dec 24, 2013 at 6:03 AM, Roy Smith <roy at panix.com> wrote:
> [2] In which case, we would just add some middleware which did:
>
> assert "-O" not in sys.argv

Aside from the fact that this wouldn't work, it won't work :) By the
time you see argv, the -O option has been eaten. But why stop at that?

def assertions_working():
    try:
        assert False
    except AssertionError:
        return True
    return False

assert assertions_working()  # refuse to run in -O mode

Can't imagine why that wouldn't work......

ChrisA



More information about the Python-list mailing list