3 ms·
When it optimizes out a statement that the spec explicitly says can be optimized out? A correct compiler is one that conforms to spec. You using a statement for
by nightpool 13y ago
When it optimizes out a statement that the spec explicitly says can be optimized out? A correct compiler is one that conforms to spec. You using a statement for something outside of its intended purpose makes the compiler incorrect?
- anonymoushn 13y agoSorry, I'm not deeply familiar with the Python spec. Outside of C or a lisp I would expect assert to behave more like a function which discards its arguments when disabled and less like a macro which stops evaluating its arguments when disabled. This expectation would obviously be incorrect in the case of Python, which is fairly explicit as to the meaning of assert[0]: if __debug__: if not expression: raise AssertionError My mistake! [0]: http://docs.python.org/2/reference/simple_stmts.html#the-assert-statement http://docs.python.org/2/reference/simple_stmts.html#the-ass...
- deleted 13y ago[deleted]